Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: chrome/browser/extensions/api/proxy/proxy_api.cc

Issue 2888073002: Remove raw DictionaryValue::Set in //chrome (Closed)
Patch Set: Fix Tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 switch (mode) { 164 switch (mode) {
165 case ProxyPrefs::MODE_DIRECT: 165 case ProxyPrefs::MODE_DIRECT:
166 case ProxyPrefs::MODE_AUTO_DETECT: 166 case ProxyPrefs::MODE_AUTO_DETECT:
167 case ProxyPrefs::MODE_SYSTEM: 167 case ProxyPrefs::MODE_SYSTEM:
168 // These modes have no further parameters. 168 // These modes have no further parameters.
169 break; 169 break;
170 case ProxyPrefs::MODE_PAC_SCRIPT: { 170 case ProxyPrefs::MODE_PAC_SCRIPT: {
171 // A PAC URL either point to a PAC script or contain a base64 encoded 171 // A PAC URL either point to a PAC script or contain a base64 encoded
172 // PAC script. In either case we build a PacScript dictionary as defined 172 // PAC script. In either case we build a PacScript dictionary as defined
173 // in the extension API. 173 // in the extension API.
174 base::DictionaryValue* pac_dict = helpers::CreatePacScriptDict(config); 174 std::unique_ptr<base::DictionaryValue> pac_dict =
175 helpers::CreatePacScriptDict(config);
175 if (!pac_dict) 176 if (!pac_dict)
176 return nullptr; 177 return nullptr;
177 extension_pref->Set(keys::kProxyConfigPacScript, pac_dict); 178 extension_pref->Set(keys::kProxyConfigPacScript, std::move(pac_dict));
178 break; 179 break;
179 } 180 }
180 case ProxyPrefs::MODE_FIXED_SERVERS: { 181 case ProxyPrefs::MODE_FIXED_SERVERS: {
181 // Build ProxyRules dictionary according to the extension API. 182 // Build ProxyRules dictionary according to the extension API.
182 base::DictionaryValue* proxy_rules_dict = 183 std::unique_ptr<base::DictionaryValue> proxy_rules_dict =
183 helpers::CreateProxyRulesDict(config); 184 helpers::CreateProxyRulesDict(config);
184 if (!proxy_rules_dict) 185 if (!proxy_rules_dict)
185 return nullptr; 186 return nullptr;
186 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); 187 extension_pref->Set(keys::kProxyConfigRules, std::move(proxy_rules_dict));
187 break; 188 break;
188 } 189 }
189 case ProxyPrefs::kModeCount: 190 case ProxyPrefs::kModeCount:
190 NOTREACHED(); 191 NOTREACHED();
191 } 192 }
192 // TODO(crbug.com/703565): remove std::move() once compiler support improves. 193 // TODO(crbug.com/703565): remove std::move() once compiler support improves.
193 return std::move(extension_pref); 194 return std::move(extension_pref);
194 } 195 }
195 196
196 } // namespace extensions 197 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698