| 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 #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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |