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 "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
11 | 11 |
| 12 namespace net { |
| 13 class ProxyServer; |
| 14 } |
| 15 |
12 class DictionaryValue; | 16 class DictionaryValue; |
13 | 17 |
14 class ProxySettingsFunction : public SyncExtensionFunction { | 18 class ProxySettingsFunction : public SyncExtensionFunction { |
15 public: | 19 public: |
16 virtual ~ProxySettingsFunction() {} | 20 virtual ~ProxySettingsFunction() {} |
17 virtual bool RunImpl() = 0; | 21 virtual bool RunImpl() = 0; |
18 protected: | 22 protected: |
19 // Takes ownership of |pref_value|. | 23 // Takes ownership of |pref_value|. |
20 void ApplyPreference( | 24 void ApplyPreference( |
21 const char* pref_path, Value* pref_value, bool incognito); | 25 const char* pref_path, Value* pref_value, bool incognito); |
(...skipping 10 matching lines...) Expand all Loading... |
32 | 36 |
33 class RemoveCustomProxySettingsFunction : public ProxySettingsFunction { | 37 class RemoveCustomProxySettingsFunction : public ProxySettingsFunction { |
34 public: | 38 public: |
35 virtual ~RemoveCustomProxySettingsFunction() {} | 39 virtual ~RemoveCustomProxySettingsFunction() {} |
36 virtual bool RunImpl(); | 40 virtual bool RunImpl(); |
37 | 41 |
38 DECLARE_EXTENSION_FUNCTION_NAME( | 42 DECLARE_EXTENSION_FUNCTION_NAME( |
39 "experimental.proxy.removeCustomProxySettings") | 43 "experimental.proxy.removeCustomProxySettings") |
40 }; | 44 }; |
41 | 45 |
| 46 class GetCurrentProxySettingsFunction : public ProxySettingsFunction { |
| 47 public: |
| 48 virtual ~GetCurrentProxySettingsFunction() {} |
| 49 virtual bool RunImpl(); |
| 50 |
| 51 DECLARE_EXTENSION_FUNCTION_NAME( |
| 52 "experimental.proxy.getCurrentProxySettings") |
| 53 private: |
| 54 // Convert the representation of a proxy configuration from the format |
| 55 // that is stored in the pref stores to the format that is used by the API. |
| 56 // See ProxyServer type defined in |experimental.proxy|. |
| 57 bool ConvertToApiFormat(const DictionaryValue* proxy_prefs, |
| 58 DictionaryValue* api_proxy_config) const; |
| 59 bool ParseRules(const std::string& rules, DictionaryValue* out) const; |
| 60 DictionaryValue* ConvertToDictionary(const net::ProxyServer& proxy) const; |
| 61 }; |
| 62 |
42 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | 63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ |
OLD | NEW |