| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // net::ProxyConfigService interface by fowarding the methods to this class | 28 // net::ProxyConfigService interface by fowarding the methods to this class |
| 29 // - retrieves initial system proxy configuration from cros settings persisted | 29 // - retrieves initial system proxy configuration from cros settings persisted |
| 30 // on chromeos device from chromeos revisions before migration to flimflam, | 30 // on chromeos device from chromeos revisions before migration to flimflam, |
| 31 // - persists proxy setting per network in flimflim | 31 // - persists proxy setting per network in flimflim |
| 32 // - provides network stack with latest proxy configuration for currently | 32 // - provides network stack with latest proxy configuration for currently |
| 33 // active network for use on IO thread | 33 // active network for use on IO thread |
| 34 // - provides UI with methods to retrieve and modify proxy configuration for | 34 // - provides UI with methods to retrieve and modify proxy configuration for |
| 35 // any network (either currently active or non-active) on UI thread | 35 // any network (either currently active or non-active) on UI thread |
| 36 class ProxyConfigServiceImpl | 36 class ProxyConfigServiceImpl |
| 37 : public base::RefCountedThreadSafe<ProxyConfigServiceImpl>, | 37 : public base::RefCountedThreadSafe<ProxyConfigServiceImpl>, |
| 38 public SignedSettings::Delegate<std::string>, | 38 public SignedSettings::Delegate<const base::Value*>, |
| 39 public NetworkLibrary::NetworkManagerObserver, | 39 public NetworkLibrary::NetworkManagerObserver, |
| 40 public NetworkLibrary::NetworkObserver { | 40 public NetworkLibrary::NetworkObserver { |
| 41 public: | 41 public: |
| 42 // ProxyConfigServiceImpl is created on the UI thread in | 42 // ProxyConfigServiceImpl is created on the UI thread in |
| 43 // chrome/browser/net/proxy_service_factory.cc::CreateProxyConfigService | 43 // chrome/browser/net/proxy_service_factory.cc::CreateProxyConfigService |
| 44 // via BrowserProcess::chromeos_proxy_config_service_impl, and stored in | 44 // via BrowserProcess::chromeos_proxy_config_service_impl, and stored in |
| 45 // g_browser_process as a scoped_refptr (because it's RefCountedThreadSafe). | 45 // g_browser_process as a scoped_refptr (because it's RefCountedThreadSafe). |
| 46 // | 46 // |
| 47 // Past that point, it can be accessed from the IO or UI threads. | 47 // Past that point, it can be accessed from the IO or UI threads. |
| 48 // | 48 // |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 bool UISetProxyConfigToPACScript(const GURL& pac_url); | 225 bool UISetProxyConfigToPACScript(const GURL& pac_url); |
| 226 bool UISetProxyConfigToSingleProxy(const net::ProxyServer& server); | 226 bool UISetProxyConfigToSingleProxy(const net::ProxyServer& server); |
| 227 // |scheme| is one of "http", "https", "ftp" or "socks". | 227 // |scheme| is one of "http", "https", "ftp" or "socks". |
| 228 bool UISetProxyConfigToProxyPerScheme(const std::string& scheme, | 228 bool UISetProxyConfigToProxyPerScheme(const std::string& scheme, |
| 229 const net::ProxyServer& server); | 229 const net::ProxyServer& server); |
| 230 // Only valid for MODE_SINGLE_PROXY or MODE_PROXY_PER_SCHEME. | 230 // Only valid for MODE_SINGLE_PROXY or MODE_PROXY_PER_SCHEME. |
| 231 bool UISetProxyConfigBypassRules(const net::ProxyBypassRules& bypass_rules); | 231 bool UISetProxyConfigBypassRules(const net::ProxyBypassRules& bypass_rules); |
| 232 | 232 |
| 233 // Implementation for SignedSettings::Delegate | 233 // Implementation for SignedSettings::Delegate |
| 234 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, | 234 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, |
| 235 std::string value); | 235 const base::Value* value) OVERRIDE; |
| 236 | 236 |
| 237 // NetworkLibrary::NetworkManagerObserver implementation. | 237 // NetworkLibrary::NetworkManagerObserver implementation. |
| 238 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); | 238 virtual void OnNetworkManagerChanged(NetworkLibrary* cros) OVERRIDE; |
| 239 | 239 |
| 240 // NetworkLibrary::NetworkObserver implementation. | 240 // NetworkLibrary::NetworkObserver implementation. |
| 241 virtual void OnNetworkChanged(NetworkLibrary* cros, const Network* network); | 241 virtual void OnNetworkChanged(NetworkLibrary* cros, |
| 242 const Network* network) OVERRIDE; |
| 242 | 243 |
| 243 #if defined(UNIT_TEST) | 244 #if defined(UNIT_TEST) |
| 244 void SetTesting() { | 245 void SetTesting() { |
| 245 testing_ = true; | 246 testing_ = true; |
| 246 active_network_ = "test"; | 247 active_network_ = "test"; |
| 247 UIMakeActiveNetworkCurrent(); | 248 UIMakeActiveNetworkCurrent(); |
| 248 } | 249 } |
| 249 #endif // defined(UNIT_TEST) | 250 #endif // defined(UNIT_TEST) |
| 250 | 251 |
| 251 private: | 252 private: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 337 |
| 337 // Operation to retrieve proxy setting from device. | 338 // Operation to retrieve proxy setting from device. |
| 338 scoped_refptr<SignedSettings> retrieve_property_op_; | 339 scoped_refptr<SignedSettings> retrieve_property_op_; |
| 339 | 340 |
| 340 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 341 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
| 341 }; | 342 }; |
| 342 | 343 |
| 343 } // namespace chromeos | 344 } // namespace chromeos |
| 344 | 345 |
| 345 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 346 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
| OLD | NEW |