| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/proxy/proxy_api.h" | 7 #include "chrome/browser/extensions/api/proxy/proxy_api.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 config, &pac_url, error, bad_message) || | 126 config, &pac_url, error, bad_message) || |
| 127 !helpers::GetPacDataFromExtensionPref( | 127 !helpers::GetPacDataFromExtensionPref( |
| 128 config, &pac_data, error, bad_message) || | 128 config, &pac_data, error, bad_message) || |
| 129 !helpers::GetProxyRulesStringFromExtensionPref( | 129 !helpers::GetProxyRulesStringFromExtensionPref( |
| 130 config, &proxy_rules_string, error, bad_message) || | 130 config, &proxy_rules_string, error, bad_message) || |
| 131 !helpers::GetBypassListFromExtensionPref( | 131 !helpers::GetBypassListFromExtensionPref( |
| 132 config, &bypass_list, error, bad_message)) { | 132 config, &bypass_list, error, bad_message)) { |
| 133 return NULL; | 133 return NULL; |
| 134 } | 134 } |
| 135 | 135 |
| 136 return helpers::CreateProxyConfigDict( | 136 return helpers::CreateProxyConfigDict(mode_enum, pac_mandatory, pac_url, |
| 137 mode_enum, pac_mandatory, pac_url, pac_data, proxy_rules_string, | 137 pac_data, proxy_rules_string, |
| 138 bypass_list, error); | 138 bypass_list, error) |
| 139 .release(); |
| 139 } | 140 } |
| 140 | 141 |
| 141 base::Value* ProxyPrefTransformer::BrowserToExtensionPref( | 142 base::Value* ProxyPrefTransformer::BrowserToExtensionPref( |
| 142 const base::Value* browser_pref) { | 143 const base::Value* browser_pref) { |
| 143 CHECK(browser_pref->IsType(base::Value::Type::DICTIONARY)); | 144 CHECK(browser_pref->IsType(base::Value::Type::DICTIONARY)); |
| 144 | 145 |
| 145 // This is a dictionary wrapper that exposes the proxy configuration stored in | 146 // This is a dictionary wrapper that exposes the proxy configuration stored in |
| 146 // the browser preferences. | 147 // the browser preferences. |
| 147 ProxyConfigDictionary config( | 148 ProxyConfigDictionary config( |
| 148 static_cast<const base::DictionaryValue*>(browser_pref)); | 149 static_cast<const base::DictionaryValue*>(browser_pref)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); | 186 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); |
| 186 break; | 187 break; |
| 187 } | 188 } |
| 188 case ProxyPrefs::kModeCount: | 189 case ProxyPrefs::kModeCount: |
| 189 NOTREACHED(); | 190 NOTREACHED(); |
| 190 } | 191 } |
| 191 return extension_pref.release(); | 192 return extension_pref.release(); |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace extensions | 195 } // namespace extensions |
| OLD | NEW |