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 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 5 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 bool ProxyConfigDictionary::GetBypassList(std::string* out) const { | 60 bool ProxyConfigDictionary::GetBypassList(std::string* out) const { |
61 return dict_->GetString(kProxyBypassList, out); | 61 return dict_->GetString(kProxyBypassList, out); |
62 } | 62 } |
63 | 63 |
64 bool ProxyConfigDictionary::HasBypassList() const { | 64 bool ProxyConfigDictionary::HasBypassList() const { |
65 return dict_->HasKey(kProxyBypassList); | 65 return dict_->HasKey(kProxyBypassList); |
66 } | 66 } |
67 | 67 |
68 // static | 68 // static |
69 DictionaryValue* ProxyConfigDictionary::CreateDirect() { | 69 DictionaryValue* ProxyConfigDictionary::CreateDirect() { |
70 return CreateDictionary(ProxyPrefs::MODE_DIRECT, "", false, "", ""); | 70 return CreateDictionary(ProxyPrefs::MODE_DIRECT, |
| 71 std::string(), |
| 72 false, |
| 73 std::string(), |
| 74 std::string()); |
71 } | 75 } |
72 | 76 |
73 // static | 77 // static |
74 DictionaryValue* ProxyConfigDictionary::CreateAutoDetect() { | 78 DictionaryValue* ProxyConfigDictionary::CreateAutoDetect() { |
75 return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, "", false, "", ""); | 79 return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, |
| 80 std::string(), |
| 81 false, |
| 82 std::string(), |
| 83 std::string()); |
76 } | 84 } |
77 | 85 |
78 // static | 86 // static |
79 DictionaryValue* ProxyConfigDictionary::CreatePacScript( | 87 DictionaryValue* ProxyConfigDictionary::CreatePacScript( |
80 const std::string& pac_url, | 88 const std::string& pac_url, |
81 bool pac_mandatory) { | 89 bool pac_mandatory) { |
82 return CreateDictionary(ProxyPrefs::MODE_PAC_SCRIPT, | 90 return CreateDictionary(ProxyPrefs::MODE_PAC_SCRIPT, |
83 pac_url, pac_mandatory, "", ""); | 91 pac_url, |
| 92 pac_mandatory, |
| 93 std::string(), |
| 94 std::string()); |
84 } | 95 } |
85 | 96 |
86 // static | 97 // static |
87 DictionaryValue* ProxyConfigDictionary::CreateFixedServers( | 98 DictionaryValue* ProxyConfigDictionary::CreateFixedServers( |
88 const std::string& proxy_server, | 99 const std::string& proxy_server, |
89 const std::string& bypass_list) { | 100 const std::string& bypass_list) { |
90 if (!proxy_server.empty()) { | 101 if (!proxy_server.empty()) { |
91 return CreateDictionary( | 102 return CreateDictionary(ProxyPrefs::MODE_FIXED_SERVERS, |
92 ProxyPrefs::MODE_FIXED_SERVERS, "", false, proxy_server, bypass_list); | 103 std::string(), |
| 104 false, |
| 105 proxy_server, |
| 106 bypass_list); |
93 } else { | 107 } else { |
94 return CreateDirect(); | 108 return CreateDirect(); |
95 } | 109 } |
96 } | 110 } |
97 | 111 |
98 // static | 112 // static |
99 DictionaryValue* ProxyConfigDictionary::CreateSystem() { | 113 DictionaryValue* ProxyConfigDictionary::CreateSystem() { |
100 return CreateDictionary(ProxyPrefs::MODE_SYSTEM, "", false, "", ""); | 114 return CreateDictionary(ProxyPrefs::MODE_SYSTEM, |
| 115 std::string(), |
| 116 false, |
| 117 std::string(), |
| 118 std::string()); |
101 } | 119 } |
102 | 120 |
103 // static | 121 // static |
104 DictionaryValue* ProxyConfigDictionary::CreateDictionary( | 122 DictionaryValue* ProxyConfigDictionary::CreateDictionary( |
105 ProxyPrefs::ProxyMode mode, | 123 ProxyPrefs::ProxyMode mode, |
106 const std::string& pac_url, | 124 const std::string& pac_url, |
107 bool pac_mandatory, | 125 bool pac_mandatory, |
108 const std::string& proxy_server, | 126 const std::string& proxy_server, |
109 const std::string& bypass_list) { | 127 const std::string& bypass_list) { |
110 DictionaryValue* dict = new DictionaryValue(); | 128 DictionaryValue* dict = new DictionaryValue(); |
111 dict->SetString(kProxyMode, ProxyModeToString(mode)); | 129 dict->SetString(kProxyMode, ProxyModeToString(mode)); |
112 if (!pac_url.empty()) { | 130 if (!pac_url.empty()) { |
113 dict->SetString(kProxyPacUrl, pac_url); | 131 dict->SetString(kProxyPacUrl, pac_url); |
114 dict->SetBoolean(kProxyPacMandatory, pac_mandatory); | 132 dict->SetBoolean(kProxyPacMandatory, pac_mandatory); |
115 } | 133 } |
116 if (!proxy_server.empty()) | 134 if (!proxy_server.empty()) |
117 dict->SetString(kProxyServer, proxy_server); | 135 dict->SetString(kProxyServer, proxy_server); |
118 if (!bypass_list.empty()) | 136 if (!bypass_list.empty()) |
119 dict->SetString(kProxyBypassList, bypass_list); | 137 dict->SetString(kProxyBypassList, bypass_list); |
120 return dict; | 138 return dict; |
121 } | 139 } |
OLD | NEW |