summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_proxy_api.h
diff options
context:
space:
mode:
authorbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 15:21:02 +0000
committerbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 15:21:02 +0000
commit365c724e6df12d8af2109718f142a2432e663125 (patch)
treef19fdc89d9bd60db5fc4cbb3927386dff4444b43 /chrome/browser/extensions/extension_proxy_api.h
parentd8d6d70398a65e60d4158ec440640fbce2ae0631 (diff)
downloadchromium_src-365c724e6df12d8af2109718f142a2432e663125.zip
chromium_src-365c724e6df12d8af2109718f142a2432e663125.tar.gz
chromium_src-365c724e6df12d8af2109718f142a2432e663125.tar.bz2
Cleanup of Proxy Settings API implementation.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6749009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_proxy_api.h')
-rw-r--r--chrome/browser/extensions/extension_proxy_api.h73
1 files changed, 5 insertions, 68 deletions
diff --git a/chrome/browser/extensions/extension_proxy_api.h b/chrome/browser/extensions/extension_proxy_api.h
index c7a40ed..5fb1c8d 100644
--- a/chrome/browser/extensions/extension_proxy_api.h
+++ b/chrome/browser/extensions/extension_proxy_api.h
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Defines the Chrome Extensions Proxy Settings API relevant classes to realize
+// the API as specified in chrome/common/extensions/api/extension_api.json.
+
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_
@@ -11,13 +14,13 @@
#include "chrome/browser/extensions/extension_preference_api.h"
#include "chrome/browser/prefs/proxy_prefs.h"
#include "chrome/browser/profiles/profile.h"
-#include "net/proxy/proxy_config.h"
-class DictionaryValue;
+class Value;
class ExtensionEventRouterForwarder;
// Class to convert between the representation of proxy settings used
// in the Proxy Settings API and the representation used in the PrefStores.
+// This plugs into the ExtensionPreferenceAPI to get and set proxy settings.
class ProxyPrefTransformer : public PrefTransformerInterface {
public:
ProxyPrefTransformer();
@@ -29,72 +32,6 @@ class ProxyPrefTransformer : public PrefTransformerInterface {
virtual Value* BrowserToExtensionPref(const Value* browser_pref) OVERRIDE;
private:
- // Helper functions for extension->browser pref transformation:
-
- // The following functions extract one piece of data from the |proxy_config|
- // each. |proxy_config| is a ProxyConfig dictionary as defined in the
- // extension API.
- //
- // - If there are NO entries for the respective pieces of data, the functions
- // return true.
- // - If there ARE entries and they could be parsed, the functions set |out|
- // and return true.
- // - If there are entries that could not be parsed, the functions set |error|
- // and return false.
- bool GetProxyModeFromExtensionPref(const DictionaryValue* proxy_config,
- ProxyPrefs::ProxyMode* out,
- std::string* error) const;
- bool GetPacUrlFromExtensionPref(const DictionaryValue* proxy_config,
- std::string* out,
- std::string* error) const;
- bool GetPacDataFromExtensionPref(const DictionaryValue* proxy_config,
- std::string* out,
- std::string* error) const;
- bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config,
- std::string* out,
- std::string* error) const;
- bool GetBypassListFromExtensionPref(const DictionaryValue* proxy_config,
- std::string *out,
- std::string* error) const;
-
- // Creates a Browser Pref dictionary from the given parameters. Depending on
- // the value of |mode_enum|, several of the strings may be empty.
- Value* ExtensionToBrowserPref(ProxyPrefs::ProxyMode mode_enum,
- const std::string& pac_url,
- const std::string& pac_data,
- const std::string& proxy_rules_string,
- const std::string& bypass_list,
- std::string* error) const;
-
- // Converts a ProxyServer dictionary instance |dict| as passed by the API
- // caller (e.g. for the http proxy in the rules element) to a
- // net::ProxyServer.
- // Returns true if successful and sets |error| otherwise.
- bool GetProxyServer(const DictionaryValue* dict,
- net::ProxyServer::Scheme default_scheme,
- net::ProxyServer* proxy_server,
- std::string* error) const;
-
- // Joins a list of URLs (stored as StringValues) in |list| with |joiner|
- // to |out|. Returns true if successful and sets |error| otherwise.
- bool JoinUrlList(ListValue* list,
- const std::string& joiner,
- std::string* out,
- std::string* error) const;
-
-
- // Helper functions for browser->extension pref transformation:
-
- // Converts a net::ProxyConfig::ProxyRules object to a ProxyRules dictionary
- // as defined in the extension API. Returns true if successful.
- bool ConvertProxyRules(const net::ProxyConfig::ProxyRules& config,
- DictionaryValue* extension_proxy_rules) const;
-
- // Converts a net::ProxyServer object to a new ProxyServer dictionary as
- // defined in the extension API.
- void ConvertProxyServer(const net::ProxyServer& proxy,
- DictionaryValue** extension_proxy_server) const;
-
DISALLOW_COPY_AND_ASSIGN(ProxyPrefTransformer);
};