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

Side by Side Diff: chrome/browser/chromeos/mobile_config.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 #include "chrome/browser/chromeos/mobile_config.h" 5 #include "chrome/browser/chromeos/mobile_config.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 // Extract list of deals for this carrier. 175 // Extract list of deals for this carrier.
176 const base::ListValue* deals_list = NULL; 176 const base::ListValue* deals_list = NULL;
177 if (carrier_dict->GetList(kDealsAttr, &deals_list)) { 177 if (carrier_dict->GetList(kDealsAttr, &deals_list)) {
178 for (size_t i = 0; i < deals_list->GetSize(); ++i) { 178 for (size_t i = 0; i < deals_list->GetSize(); ++i) {
179 const base::DictionaryValue* deal_dict = NULL; 179 const base::DictionaryValue* deal_dict = NULL;
180 if (deals_list->GetDictionary(i, &deal_dict)) { 180 if (deals_list->GetDictionary(i, &deal_dict)) {
181 scoped_ptr<CarrierDeal> deal(new CarrierDeal(deal_dict)); 181 std::unique_ptr<CarrierDeal> deal(new CarrierDeal(deal_dict));
182 // Filter out deals by initial_locale right away. 182 // Filter out deals by initial_locale right away.
183 std::vector<std::string>::const_iterator iter = 183 std::vector<std::string>::const_iterator iter =
184 std::find(deal->locales().begin(), 184 std::find(deal->locales().begin(),
185 deal->locales().end(), 185 deal->locales().end(),
186 initial_locale); 186 initial_locale);
187 if (iter != deal->locales().end()) { 187 if (iter != deal->locales().end()) {
188 const std::string& deal_id = deal->deal_id(); 188 const std::string& deal_id = deal->deal_id();
189 deals_[deal_id] = deal.release(); 189 deals_[deal_id] = deal.release();
190 } 190 }
191 } 191 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 base::Unretained(this), // this class is a singleton. 326 base::Unretained(this), // this class is a singleton.
327 base::FilePath(kGlobalCarrierConfigPath), 327 base::FilePath(kGlobalCarrierConfigPath),
328 base::FilePath(kLocalCarrierConfigPath))); 328 base::FilePath(kLocalCarrierConfigPath)));
329 } 329 }
330 330
331 void MobileConfig::ProcessConfig(const std::string& global_config, 331 void MobileConfig::ProcessConfig(const std::string& global_config,
332 const std::string& local_config) { 332 const std::string& local_config) {
333 // Global config is mandatory, local config is optional. 333 // Global config is mandatory, local config is optional.
334 bool global_initialized = false; 334 bool global_initialized = false;
335 bool local_initialized = true; 335 bool local_initialized = true;
336 scoped_ptr<base::DictionaryValue> global_config_root; 336 std::unique_ptr<base::DictionaryValue> global_config_root;
337 337
338 if (!global_config.empty()) { 338 if (!global_config.empty()) {
339 global_initialized = LoadManifestFromString(global_config); 339 global_initialized = LoadManifestFromString(global_config);
340 // Backup global config root as it might be 340 // Backup global config root as it might be
341 // owerwritten while loading local config. 341 // owerwritten while loading local config.
342 global_config_root.reset(root_.release()); 342 global_config_root.reset(root_.release());
343 } 343 }
344 if (!local_config.empty()) 344 if (!local_config.empty())
345 local_initialized = LoadManifestFromString(local_config); 345 local_initialized = LoadManifestFromString(local_config);
346 346
(...skipping 22 matching lines...) Expand all
369 << local_config_file.value(); 369 << local_config_file.value();
370 } 370 }
371 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 371 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
372 base::Bind(&MobileConfig::ProcessConfig, 372 base::Bind(&MobileConfig::ProcessConfig,
373 base::Unretained(this), // singleton. 373 base::Unretained(this), // singleton.
374 global_config, 374 global_config,
375 local_config)); 375 local_config));
376 } 376 }
377 377
378 } // namespace chromeos 378 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/mobile_config.h ('k') | chrome/browser/chromeos/net/cert_verify_proc_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698