Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: chrome/browser/prefs/proxy_prefs.h

Issue 6240013: Make proxy settings one atomic dictionary in the PrefStores such that modifications are atomic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/out/Debug
Patch Set: Updated to ToT and addressed Matt's comments in base-CL Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/proxy_prefs.h
diff --git a/chrome/browser/prefs/proxy_prefs.h b/chrome/browser/prefs/proxy_prefs.h
index da911d4e857db21329aaf8286ee7bd590d984008..235e5b558b4b98396f62bc3566f09da952e82fd1 100644
--- a/chrome/browser/prefs/proxy_prefs.h
+++ b/chrome/browser/prefs/proxy_prefs.h
@@ -8,6 +8,8 @@
#include <string>
+#include "base/values.h"
+
namespace ProxyPrefs {
// Possible types of specifying proxy settings. Do not change the order of
@@ -50,4 +52,40 @@ bool StringToProxyMode(const std::string& in_value,
} // namespace ProxyPrefs
+// Factory and wrapper for proxy preferences dictionaries that are stored
+// in the user preferences. The dictionary has the following structure:
+// {
+// mode: string,
+// server: string,
+// pac_url: string,
+// bypass_list: string
+// }
+// See proxy_prefs.cc for the structure of the respective strings.
+class ProxyPrefsDictionary {
danno 2011/02/04 10:32:13 How about putting this in the ProxyPrefs namespace
battre 2011/02/07 14:13:47 I have renamed ProxyPrefsDictionary to ProxyConfig
+ public:
+ explicit ProxyPrefsDictionary(const DictionaryValue* dict);
+
+ bool GetMode(ProxyPrefs::ProxyMode* out) const;
+ bool GetPacUrl(std::string* out) const;
+ bool GetProxyServer(std::string* out) const;
+ bool GetBypassList(std::string* out) const;
+
+ static DictionaryValue* CreateDirect();
+ static DictionaryValue* CreateAutoDetect();
+ static DictionaryValue* CreatePacScript(const std::string& pac_url);
+ static DictionaryValue* CreateFixedServers(
+ const std::string& proxy_server,
+ const std::string& bypass_list);
+ static DictionaryValue* CreateSystem();
+ private:
+ static DictionaryValue* CreateDictionary(ProxyPrefs::ProxyMode mode,
+ const std::string& pac_url,
+ const std::string& proxy_server,
+ const std::string& bypass_list);
+
+ const DictionaryValue* dict_; // weak pointer
danno 2011/02/04 10:32:13 Would it not be better/safer to copy the dictionar
battre 2011/02/07 14:13:47 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(ProxyPrefsDictionary);
+};
+
#endif // CHROME_BROWSER_PREFS_PROXY_PREFS_H_

Powered by Google App Engine
This is Rietveld 408576698