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 "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
11 #include "net/proxy/proxy_config.h" | 12 #include "net/proxy/proxy_config.h" |
12 | 13 |
13 class DictionaryValue; | 14 class DictionaryValue; |
| 15 class ExtensionIOEventRouter; |
| 16 |
| 17 // This class observes proxy error events and routes them to the appropriate |
| 18 // extensions listening to those events. All methods must be called on the IO |
| 19 // thread unless otherwise specified. |
| 20 class ExtensionProxyEventRouter { |
| 21 public: |
| 22 static ExtensionProxyEventRouter* GetInstance(); |
| 23 |
| 24 void OnProxyError(const ExtensionIOEventRouter* event_router); |
| 25 |
| 26 private: |
| 27 friend struct DefaultSingletonTraits<ExtensionProxyEventRouter>; |
| 28 |
| 29 ExtensionProxyEventRouter(); |
| 30 ~ExtensionProxyEventRouter(); |
| 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(ExtensionProxyEventRouter); |
| 33 }; |
14 | 34 |
15 class ProxySettingsFunction : public SyncExtensionFunction { | 35 class ProxySettingsFunction : public SyncExtensionFunction { |
16 public: | 36 public: |
17 virtual ~ProxySettingsFunction() {} | 37 virtual ~ProxySettingsFunction() {} |
18 virtual bool RunImpl() = 0; | 38 virtual bool RunImpl() = 0; |
19 protected: | 39 protected: |
20 // Takes ownership of |pref_value|. | 40 // Takes ownership of |pref_value|. |
21 void ApplyPreference( | 41 void ApplyPreference( |
22 const char* pref_path, Value* pref_value, bool incognito); | 42 const char* pref_path, Value* pref_value, bool incognito); |
23 void RemovePreference(const char* pref_path, bool incognito); | 43 void RemovePreference(const char* pref_path, bool incognito); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Convert the representation of a proxy configuration from the format | 95 // Convert the representation of a proxy configuration from the format |
76 // that is stored in the pref stores to the format that is used by the API. | 96 // that is stored in the pref stores to the format that is used by the API. |
77 // See ProxyServer type defined in |experimental.proxy|. | 97 // See ProxyServer type defined in |experimental.proxy|. |
78 bool ConvertToApiFormat(const DictionaryValue* proxy_prefs, | 98 bool ConvertToApiFormat(const DictionaryValue* proxy_prefs, |
79 DictionaryValue* api_proxy_config); | 99 DictionaryValue* api_proxy_config); |
80 bool ParseRules(const std::string& rules, DictionaryValue* out) const; | 100 bool ParseRules(const std::string& rules, DictionaryValue* out) const; |
81 DictionaryValue* ConvertToDictionary(const net::ProxyServer& proxy) const; | 101 DictionaryValue* ConvertToDictionary(const net::ProxyServer& proxy) const; |
82 }; | 102 }; |
83 | 103 |
84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ |
OLD | NEW |