| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_EXTENSION_PROXY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/browser/extensions/extension_preference_api.h" | 12 #include "chrome/browser/extensions/extension_preference_api.h" |
| 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "net/proxy/proxy_config.h" | 14 #include "net/proxy/proxy_config.h" |
| 14 | 15 |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 16 class ExtensionIOEventRouter; | 17 class ExtensionEventRouterForwarder; |
| 17 | 18 |
| 18 // This class observes proxy error events and routes them to the appropriate | 19 // This class observes proxy error events and routes them to the appropriate |
| 19 // extensions listening to those events. All methods must be called on the IO | 20 // extensions listening to those events. All methods must be called on the IO |
| 20 // thread unless otherwise specified. | 21 // thread unless otherwise specified. |
| 21 class ExtensionProxyEventRouter { | 22 class ExtensionProxyEventRouter { |
| 22 public: | 23 public: |
| 23 static ExtensionProxyEventRouter* GetInstance(); | 24 static ExtensionProxyEventRouter* GetInstance(); |
| 24 | 25 |
| 25 void OnProxyError(const ExtensionIOEventRouter* event_router, | 26 void OnProxyError(ExtensionEventRouterForwarder* event_router, |
| 27 ProfileId profile_id, |
| 26 int error_code); | 28 int error_code); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 friend struct DefaultSingletonTraits<ExtensionProxyEventRouter>; | 31 friend struct DefaultSingletonTraits<ExtensionProxyEventRouter>; |
| 30 | 32 |
| 31 ExtensionProxyEventRouter(); | 33 ExtensionProxyEventRouter(); |
| 32 ~ExtensionProxyEventRouter(); | 34 ~ExtensionProxyEventRouter(); |
| 33 | 35 |
| 34 DISALLOW_COPY_AND_ASSIGN(ExtensionProxyEventRouter); | 36 DISALLOW_COPY_AND_ASSIGN(ExtensionProxyEventRouter); |
| 35 }; | 37 }; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Convert the representation of a proxy configuration from the format | 78 // Convert the representation of a proxy configuration from the format |
| 77 // that is stored in the pref stores to the format that is used by the API. | 79 // that is stored in the pref stores to the format that is used by the API. |
| 78 // See ProxyServer type defined in |experimental.proxy|. | 80 // See ProxyServer type defined in |experimental.proxy|. |
| 79 bool ConvertToApiFormat(const DictionaryValue* proxy_prefs, | 81 bool ConvertToApiFormat(const DictionaryValue* proxy_prefs, |
| 80 DictionaryValue* api_proxy_config); | 82 DictionaryValue* api_proxy_config); |
| 81 bool ParseRules(const std::string& rules, DictionaryValue* out) const; | 83 bool ParseRules(const std::string& rules, DictionaryValue* out) const; |
| 82 DictionaryValue* ConvertToDictionary(const net::ProxyServer& proxy) const; | 84 DictionaryValue* ConvertToDictionary(const net::ProxyServer& proxy) const; |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | 87 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ |
| OLD | NEW |