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

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

Issue 2934043002: Use ContainsValue() instead of std::find() in chrome/browser/chromeos (Closed)
Patch Set: Fixed compilation error. Created 3 years, 6 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>
10 #include <utility> 9 #include <utility>
11 10
12 #include "base/bind.h" 11 #include "base/bind.h"
13 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
15 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
16 #include "base/logging.h" 15 #include "base/logging.h"
17 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/stl_util.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/login/startup_utils.h" 20 #include "chrome/browser/chromeos/login/startup_utils.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 namespace { 25 namespace {
26 26
27 // Config attributes names. 27 // Config attributes names.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 // Extract list of deals for this carrier. 176 // Extract list of deals for this carrier.
177 const base::ListValue* deals_list = NULL; 177 const base::ListValue* deals_list = NULL;
178 if (carrier_dict->GetList(kDealsAttr, &deals_list)) { 178 if (carrier_dict->GetList(kDealsAttr, &deals_list)) {
179 for (size_t i = 0; i < deals_list->GetSize(); ++i) { 179 for (size_t i = 0; i < deals_list->GetSize(); ++i) {
180 const base::DictionaryValue* deal_dict = NULL; 180 const base::DictionaryValue* deal_dict = NULL;
181 if (deals_list->GetDictionary(i, &deal_dict)) { 181 if (deals_list->GetDictionary(i, &deal_dict)) {
182 std::unique_ptr<CarrierDeal> deal(new CarrierDeal(deal_dict)); 182 std::unique_ptr<CarrierDeal> deal(new CarrierDeal(deal_dict));
183 // Filter out deals by initial_locale right away. 183 // Filter out deals by initial_locale right away.
184 auto iter = std::find(deal->locales().begin(), deal->locales().end(), 184 if (base::ContainsValue(deal->locales(), initial_locale)) {
185 initial_locale);
186 if (iter != deal->locales().end()) {
187 const std::string& deal_id = deal->deal_id(); 185 const std::string& deal_id = deal->deal_id();
188 deals_[deal_id] = std::move(deal); 186 deals_[deal_id] = std::move(deal);
189 } 187 }
190 } 188 }
191 } 189 }
192 } 190 }
193 } 191 }
194 192
195 void MobileConfig::Carrier::RemoveDeals() { 193 void MobileConfig::Carrier::RemoveDeals() {
196 deals_.clear(); 194 deals_.clear();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 << local_config_file.value(); 364 << local_config_file.value();
367 } 365 }
368 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 366 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
369 base::Bind(&MobileConfig::ProcessConfig, 367 base::Bind(&MobileConfig::ProcessConfig,
370 base::Unretained(this), // singleton. 368 base::Unretained(this), // singleton.
371 global_config, 369 global_config,
372 local_config)); 370 local_config));
373 } 371 }
374 372
375 } // namespace chromeos 373 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698