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

Side by Side Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc

Issue 2934043002: Use ContainsValue() instead of std::find() in chrome/browser/chromeos (Closed)
Patch Set: Removed #include<algorithm> when not required. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ownership/owner_settings_service_chromeos.h" 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
6 6
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/bind_helpers.h" 16 #include "base/bind_helpers.h"
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/stl_util.h"
20 #include "base/task_scheduler/post_task.h" 21 #include "base/task_scheduler/post_task.h"
21 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/threading/thread_checker.h" 23 #include "base/threading/thread_checker.h"
23 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" 25 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" 26 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #include "chrome/browser/chromeos/settings/cros_settings.h" 27 #include "chrome/browser/chromeos/settings/cros_settings.h"
27 #include "chrome/browser/chromeos/settings/device_settings_provider.h" 28 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chromeos/chromeos_switches.h" 30 #include "chromeos/chromeos_switches.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 415 }
415 416
416 // static 417 // static
417 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy( 418 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy(
418 const std::string& user_id, 419 const std::string& user_id,
419 enterprise_management::ChromeDeviceSettingsProto* settings) { 420 enterprise_management::ChromeDeviceSettingsProto* settings) {
420 if (!settings->has_allow_new_users()) 421 if (!settings->has_allow_new_users())
421 settings->mutable_allow_new_users()->set_allow_new_users(true); 422 settings->mutable_allow_new_users()->set_allow_new_users(true);
422 423
423 em::UserWhitelistProto* whitelist_proto = settings->mutable_user_whitelist(); 424 em::UserWhitelistProto* whitelist_proto = settings->mutable_user_whitelist();
424 if (whitelist_proto->user_whitelist().end() == 425 if (!base::ContainsValue(whitelist_proto->user_whitelist(), user_id)) {
achuithb 2017/06/13 20:58:23 nit: drop {}
Tripta 2017/06/14 07:36:17 Done.
425 std::find(whitelist_proto->user_whitelist().begin(),
426 whitelist_proto->user_whitelist().end(), user_id)) {
427 whitelist_proto->add_user_whitelist(user_id); 426 whitelist_proto->add_user_whitelist(user_id);
428 } 427 }
429 } 428 }
430 429
431 // static 430 // static
432 void OwnerSettingsServiceChromeOS::UpdateDeviceSettings( 431 void OwnerSettingsServiceChromeOS::UpdateDeviceSettings(
433 const std::string& path, 432 const std::string& path,
434 const base::Value& value, 433 const base::Value& value,
435 enterprise_management::ChromeDeviceSettingsProto& settings) { 434 enterprise_management::ChromeDeviceSettingsProto& settings) {
436 if (path == kAccountsPrefAllowNewUser) { 435 if (path == kAccountsPrefAllowNewUser) {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 743
745 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( 744 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring(
746 bool success) { 745 bool success) {
747 store_settings_factory_.InvalidateWeakPtrs(); 746 store_settings_factory_.InvalidateWeakPtrs();
748 for (auto& observer : observers_) 747 for (auto& observer : observers_)
749 observer.OnSignedPolicyStored(success); 748 observer.OnSignedPolicyStored(success);
750 StorePendingChanges(); 749 StorePendingChanges();
751 } 750 }
752 751
753 } // namespace chromeos 752 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698