xref: /aosp_15_r20/external/cronet/net/proxy_resolution/proxy_resolver_error_observer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_PROXY_RESOLUTION_PROXY_RESOLVER_ERROR_OBSERVER_H_
6 #define NET_PROXY_RESOLUTION_PROXY_RESOLVER_ERROR_OBSERVER_H_
7 
8 #include <string>
9 
10 #include "net/base/net_export.h"
11 
12 namespace net {
13 
14 // Interface for observing JavaScript error messages from PAC scripts.
15 class NET_EXPORT_PRIVATE ProxyResolverErrorObserver {
16  public:
17   ProxyResolverErrorObserver() = default;
18 
19   ProxyResolverErrorObserver(const ProxyResolverErrorObserver&) = delete;
20   ProxyResolverErrorObserver& operator=(const ProxyResolverErrorObserver&) =
21       delete;
22 
23   virtual ~ProxyResolverErrorObserver() = default;
24 
25   // Handler for when an error is encountered. |line_number| may be -1
26   // if a line number is not applicable to this error. |error| is a message
27   // describing the error.
28   //
29   // Note on threading: This may get called from a worker thread. If the
30   // backing proxy resolver is ProxyResolverV8Tracing, then it will not
31   // be called concurrently, however it will be called from a different
32   // thread than the proxy resolver's origin thread.
33   virtual void OnPACScriptError(int line_number,
34                                 const std::u16string& error) = 0;
35 };
36 
37 }  // namespace net
38 
39 #endif  // NET_PROXY_RESOLUTION_PROXY_RESOLVER_ERROR_OBSERVER_H_
40