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

Side by Side Diff: chromeos/settings/cros_settings_provider.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | chromeos/system/version_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/settings/cros_settings_provider.h" 5 #include "chromeos/settings/cros_settings_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chromeos/chromeos_switches.h" 11 #include "chromeos/chromeos_switches.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 CrosSettingsProvider::CrosSettingsProvider( 15 CrosSettingsProvider::CrosSettingsProvider(
16 const NotifyObserversCallback& notify_cb) 16 const NotifyObserversCallback& notify_cb)
17 : notify_cb_(notify_cb) { 17 : notify_cb_(notify_cb) {
18 } 18 }
19 19
20 CrosSettingsProvider::~CrosSettingsProvider() { 20 CrosSettingsProvider::~CrosSettingsProvider() {
21 } 21 }
22 22
23 void CrosSettingsProvider::Set(const std::string& path, 23 void CrosSettingsProvider::Set(const std::string& path,
24 const base::Value& value) { 24 const base::Value& value) {
25 // We don't allow changing any of the cros settings without prefix 25 // We don't allow changing any of the cros settings without prefix
26 // "cros.session." in the guest mode. 26 // "cros.session." in the guest mode.
27 // It should not reach here from UI in the guest mode, but just in case. 27 // It should not reach here from UI in the guest mode, but just in case.
28 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 28 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kGuestSession) && 29 switches::kGuestSession) &&
30 !::base::StartsWithASCII(path, "cros.session.", true)) { 30 !base::StartsWith(path, "cros.session.", base::CompareCase::SENSITIVE)) {
31 LOG(ERROR) << "Ignoring the guest request to change: " << path; 31 LOG(ERROR) << "Ignoring the guest request to change: " << path;
32 return; 32 return;
33 } 33 }
34 DoSet(path, value); 34 DoSet(path, value);
35 } 35 }
36 36
37 void CrosSettingsProvider::NotifyObservers(const std::string& path) { 37 void CrosSettingsProvider::NotifyObservers(const std::string& path) {
38 if (!notify_cb_.is_null()) 38 if (!notify_cb_.is_null())
39 notify_cb_.Run(path); 39 notify_cb_.Run(path);
40 } 40 }
41 41
42 void CrosSettingsProvider::SetNotifyObserversCallback( 42 void CrosSettingsProvider::SetNotifyObserversCallback(
43 const NotifyObserversCallback& notify_cb) { 43 const NotifyObserversCallback& notify_cb) {
44 notify_cb_ = notify_cb; 44 notify_cb_ = notify_cb;
45 } 45 }
46 46
47 }; // namespace chromeos 47 }; // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/disks/disk_mount_manager.cc ('k') | chromeos/system/version_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698