| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_ |
| 6 #define CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/prefs/proxy_prefs.h" |
| 14 |
| 15 class DictionaryValue; |
| 16 |
| 17 // Factory and wrapper for proxy config dictionaries that are stored |
| 18 // in the user preferences. The dictionary has the following structure: |
| 19 // { |
| 20 // mode: string, |
| 21 // server: string, |
| 22 // pac_url: string, |
| 23 // bypass_list: string |
| 24 // } |
| 25 // See proxy_config_dictionary.cc for the structure of the respective strings. |
| 26 class ProxyConfigDictionary { |
| 27 public: |
| 28 // Creates a deep copy of |dict| and leaves ownership to caller. |
| 29 explicit ProxyConfigDictionary(const DictionaryValue* dict); |
| 30 |
| 31 bool GetMode(ProxyPrefs::ProxyMode* out) const; |
| 32 bool GetPacUrl(std::string* out) const; |
| 33 bool GetProxyServer(std::string* out) const; |
| 34 bool GetBypassList(std::string* out) const; |
| 35 |
| 36 static DictionaryValue* CreateDirect(); |
| 37 static DictionaryValue* CreateAutoDetect(); |
| 38 static DictionaryValue* CreatePacScript(const std::string& pac_url); |
| 39 static DictionaryValue* CreateFixedServers( |
| 40 const std::string& proxy_server, |
| 41 const std::string& bypass_list); |
| 42 static DictionaryValue* CreateSystem(); |
| 43 private: |
| 44 static DictionaryValue* CreateDictionary(ProxyPrefs::ProxyMode mode, |
| 45 const std::string& pac_url, |
| 46 const std::string& proxy_server, |
| 47 const std::string& bypass_list); |
| 48 |
| 49 scoped_ptr<DictionaryValue> dict_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_ |
| OLD | NEW |