| 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 // Implementation of the Chrome Extensions Proxy Settings API. | 5 // Implementation of the Chrome Extensions Proxy Settings API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_proxy_api.h" | 7 #include "chrome/browser/extensions/extension_proxy_api.h" |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 std::string* error, | 96 std::string* error, |
| 97 bool* bad_message) { | 97 bool* bad_message) { |
| 98 // When ExtensionToBrowserPref is called, the format of |extension_pref| | 98 // When ExtensionToBrowserPref is called, the format of |extension_pref| |
| 99 // has been verified already by the extension API to match the schema | 99 // has been verified already by the extension API to match the schema |
| 100 // defined in chrome/common/extensions/api/extension_api.json. | 100 // defined in chrome/common/extensions/api/extension_api.json. |
| 101 CHECK(extension_pref->IsType(Value::TYPE_DICTIONARY)); | 101 CHECK(extension_pref->IsType(Value::TYPE_DICTIONARY)); |
| 102 const DictionaryValue* config = | 102 const DictionaryValue* config = |
| 103 static_cast<const DictionaryValue*>(extension_pref); | 103 static_cast<const DictionaryValue*>(extension_pref); |
| 104 | 104 |
| 105 // Extract the various pieces of information passed to | 105 // Extract the various pieces of information passed to |
| 106 // chrome.experimental.proxy.settings.set(). Several of these strings will | 106 // chrome.proxy.settings.set(). Several of these strings will |
| 107 // remain blank no respective values have been passed to set(). | 107 // remain blank no respective values have been passed to set(). |
| 108 // If a values has been passed to set but could not be parsed, we bail | 108 // If a values has been passed to set but could not be parsed, we bail |
| 109 // out and return NULL. | 109 // out and return NULL. |
| 110 ProxyPrefs::ProxyMode mode_enum; | 110 ProxyPrefs::ProxyMode mode_enum; |
| 111 bool pac_mandatory; | 111 bool pac_mandatory; |
| 112 std::string pac_url; | 112 std::string pac_url; |
| 113 std::string pac_data; | 113 std::string pac_data; |
| 114 std::string proxy_rules_string; | 114 std::string proxy_rules_string; |
| 115 std::string bypass_list; | 115 std::string bypass_list; |
| 116 if (!helpers::GetProxyModeFromExtensionPref( | 116 if (!helpers::GetProxyModeFromExtensionPref( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (!proxy_rules_dict) | 175 if (!proxy_rules_dict) |
| 176 return NULL; | 176 return NULL; |
| 177 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); | 177 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); |
| 178 break; | 178 break; |
| 179 } | 179 } |
| 180 case ProxyPrefs::kModeCount: | 180 case ProxyPrefs::kModeCount: |
| 181 NOTREACHED(); | 181 NOTREACHED(); |
| 182 } | 182 } |
| 183 return extension_pref.release(); | 183 return extension_pref.release(); |
| 184 } | 184 } |
| OLD | NEW |