1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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_NETWORK_DELEGATE_ERROR_OBSERVER_H_ 6 #define NET_PROXY_RESOLUTION_NETWORK_DELEGATE_ERROR_OBSERVER_H_ 7 8 #include <memory> 9 10 #include "base/compiler_specific.h" 11 #include "base/macros.h" 12 #include "base/memory/ref_counted.h" 13 #include "net/base/net_export.h" 14 #include "net/proxy_resolution/proxy_resolver_error_observer.h" 15 16 namespace base { 17 class SingleThreadTaskRunner; 18 } 19 20 namespace net { 21 22 class NetworkDelegate; 23 24 // An implementation of ProxyResolverErrorObserver that forwards PAC script 25 // errors to a NetworkDelegate object on the thread it lives on. 26 class NET_EXPORT_PRIVATE NetworkDelegateErrorObserver 27 : public ProxyResolverErrorObserver { 28 public: 29 NetworkDelegateErrorObserver(NetworkDelegate* network_delegate, 30 base::SingleThreadTaskRunner* origin_runner); 31 ~NetworkDelegateErrorObserver() override; 32 33 static std::unique_ptr<ProxyResolverErrorObserver> Create( 34 NetworkDelegate* network_delegate, 35 const scoped_refptr<base::SingleThreadTaskRunner>& origin_runner); 36 37 // ProxyResolverErrorObserver implementation. 38 void OnPACScriptError(int line_number, const base::string16& error) override; 39 40 private: 41 class Core; 42 43 scoped_refptr<Core> core_; 44 45 DISALLOW_COPY_AND_ASSIGN(NetworkDelegateErrorObserver); 46 }; 47 48 } // namespace net 49 50 #endif // NET_PROXY_RESOLUTION_NETWORK_DELEGATE_ERROR_OBSERVER_H_ 51