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

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: 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 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>
11 #include <memory> 10 #include <memory>
12 #include <string> 11 #include <string>
13 #include <utility> 12 #include <utility>
14 13
15 #include "base/bind.h" 14 #include "base/bind.h"
16 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
17 #include "base/callback.h" 16 #include "base/callback.h"
18 #include "base/command_line.h" 17 #include "base/command_line.h"
19 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/stl_util.h"
20 #include "base/task_scheduler/post_task.h" 20 #include "base/task_scheduler/post_task.h"
21 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" 24 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" 25 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #include "chrome/browser/chromeos/settings/cros_settings.h" 26 #include "chrome/browser/chromeos/settings/cros_settings.h"
27 #include "chrome/browser/chromeos/settings/device_settings_provider.h" 27 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chromeos/chromeos_switches.h" 29 #include "chromeos/chromeos_switches.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 415
416 // static 416 // static
417 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy( 417 void OwnerSettingsServiceChromeOS::FixupLocalOwnerPolicy(
418 const std::string& user_id, 418 const std::string& user_id,
419 enterprise_management::ChromeDeviceSettingsProto* settings) { 419 enterprise_management::ChromeDeviceSettingsProto* settings) {
420 if (!settings->has_allow_new_users()) 420 if (!settings->has_allow_new_users())
421 settings->mutable_allow_new_users()->set_allow_new_users(true); 421 settings->mutable_allow_new_users()->set_allow_new_users(true);
422 422
423 em::UserWhitelistProto* whitelist_proto = settings->mutable_user_whitelist(); 423 em::UserWhitelistProto* whitelist_proto = settings->mutable_user_whitelist();
424 if (whitelist_proto->user_whitelist().end() == 424 if (!base::ContainsValue(whitelist_proto->user_whitelist(), user_id))
425 std::find(whitelist_proto->user_whitelist().begin(),
426 whitelist_proto->user_whitelist().end(), user_id)) {
427 whitelist_proto->add_user_whitelist(user_id); 425 whitelist_proto->add_user_whitelist(user_id);
428 }
429 } 426 }
430 427
431 // static 428 // static
432 void OwnerSettingsServiceChromeOS::UpdateDeviceSettings( 429 void OwnerSettingsServiceChromeOS::UpdateDeviceSettings(
433 const std::string& path, 430 const std::string& path,
434 const base::Value& value, 431 const base::Value& value,
435 enterprise_management::ChromeDeviceSettingsProto& settings) { 432 enterprise_management::ChromeDeviceSettingsProto& settings) {
436 if (path == kAccountsPrefAllowNewUser) { 433 if (path == kAccountsPrefAllowNewUser) {
437 em::AllowNewUsersProto* allow = settings.mutable_allow_new_users(); 434 em::AllowNewUsersProto* allow = settings.mutable_allow_new_users();
438 bool allow_value; 435 bool allow_value;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 741
745 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( 742 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring(
746 bool success) { 743 bool success) {
747 store_settings_factory_.InvalidateWeakPtrs(); 744 store_settings_factory_.InvalidateWeakPtrs();
748 for (auto& observer : observers_) 745 for (auto& observer : observers_)
749 observer.OnSignedPolicyStored(success); 746 observer.OnSignedPolicyStored(success);
750 StorePendingChanges(); 747 StorePendingChanges();
751 } 748 }
752 749
753 } // namespace chromeos 750 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/mobile_config.cc ('k') | chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698