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