| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ | 5 #ifndef CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ |
| 6 #define CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ | 6 #define CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 #include "net/proxy/dhcp_proxy_script_fetcher.h" | 12 #include "net/proxy/dhcp_proxy_script_fetcher.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 class URLRequestContext; | 16 class URLRequestContext; |
| 17 class ProxyScriptFetcher; | 17 class ProxyScriptFetcher; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 // ChromeOS specific implementation of DhcpProxyScriptFetcher. | 22 // ChromeOS specific implementation of DhcpProxyScriptFetcher. |
| 23 // This looks up Service.WebProxyAutoDiscoveryUrl for the default network | 23 // This looks up Service.WebProxyAutoDiscoveryUrl for the default network |
| 24 // from Shill and uses that to fetch the proxy script if available. | 24 // from Shill and uses that to fetch the proxy script if available. |
| 25 class CHROMEOS_EXPORT DhcpProxyScriptFetcherChromeos | 25 class CHROMEOS_EXPORT DhcpProxyScriptFetcherChromeos |
| 26 : public net::DhcpProxyScriptFetcher { | 26 : public net::DhcpProxyScriptFetcher { |
| 27 public: | 27 public: |
| 28 explicit DhcpProxyScriptFetcherChromeos( | 28 explicit DhcpProxyScriptFetcherChromeos( |
| 29 net::URLRequestContext* url_request_context); | 29 net::URLRequestContext* url_request_context); |
| 30 virtual ~DhcpProxyScriptFetcherChromeos() OVERRIDE; | 30 virtual ~DhcpProxyScriptFetcherChromeos() override; |
| 31 | 31 |
| 32 // net::DhcpProxyScriptFetcher | 32 // net::DhcpProxyScriptFetcher |
| 33 virtual int Fetch(base::string16* utf16_text, | 33 virtual int Fetch(base::string16* utf16_text, |
| 34 const net::CompletionCallback& callback) OVERRIDE; | 34 const net::CompletionCallback& callback) override; |
| 35 virtual void Cancel() OVERRIDE; | 35 virtual void Cancel() override; |
| 36 virtual const GURL& GetPacURL() const OVERRIDE; | 36 virtual const GURL& GetPacURL() const override; |
| 37 virtual std::string GetFetcherName() const OVERRIDE; | 37 virtual std::string GetFetcherName() const override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void ContinueFetch(base::string16* utf16_text, | 40 void ContinueFetch(base::string16* utf16_text, |
| 41 net::CompletionCallback callback, | 41 net::CompletionCallback callback, |
| 42 std::string pac_url); | 42 std::string pac_url); |
| 43 | 43 |
| 44 net::URLRequestContext* url_request_context_; // Weak ptr | 44 net::URLRequestContext* url_request_context_; // Weak ptr |
| 45 scoped_ptr<net::ProxyScriptFetcher> proxy_script_fetcher_; | 45 scoped_ptr<net::ProxyScriptFetcher> proxy_script_fetcher_; |
| 46 scoped_refptr<base::MessageLoopProxy> network_handler_message_loop_; | 46 scoped_refptr<base::MessageLoopProxy> network_handler_message_loop_; |
| 47 base::WeakPtrFactory<DhcpProxyScriptFetcherChromeos> weak_ptr_factory_; | 47 base::WeakPtrFactory<DhcpProxyScriptFetcherChromeos> weak_ptr_factory_; |
| 48 | 48 |
| 49 GURL pac_url_; | 49 GURL pac_url_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherChromeos); | 51 DISALLOW_COPY_AND_ASSIGN(DhcpProxyScriptFetcherChromeos); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace chromeos | 54 } // namespace chromeos |
| 55 | 55 |
| 56 #endif // CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ | 56 #endif // CHROMEOS_NETWORK_DHCP_PROXY_SCRIPT_FETCHER_CHROMEOS_H_ |
| OLD | NEW |