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

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

Issue 9289017: Apply individual policies for the various parts of device status reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Julian's comments. Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/policy/policy_templates.json ('k') | chrome/browser/chromeos/cros_settings_names.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/cros_settings.h" 5 #include "chrome/browser/chromeos/cros_settings.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 std::string("*").append(email.substr(at_pos))); 117 std::string("*").append(email.substr(at_pos)));
118 return value->Find(wildcarded_value) != value->end(); 118 return value->Find(wildcarded_value) != value->end();
119 } 119 }
120 } 120 }
121 return false; 121 return false;
122 } 122 }
123 123
124 bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) { 124 bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) {
125 DCHECK(CalledOnValidThread()); 125 DCHECK(CalledOnValidThread());
126 providers_.push_back(provider); 126 providers_.push_back(provider);
127
128 // Allow the provider to notify this object when settings have changed.
129 // Providers instantiated inside this class will have the same callback
130 // passed to their constructor, but doing it here allows for providers
131 // to be instantiated outside this class.
132 CrosSettingsProvider::NotifyObserversCallback notify_cb(
133 base::Bind(&CrosSettings::FireObservers, base::Unretained(this)));
134 provider->SetNotifyObserversCallback(notify_cb);
127 return true; 135 return true;
128 } 136 }
129 137
130 bool CrosSettings::RemoveSettingsProvider(CrosSettingsProvider* provider) { 138 bool CrosSettings::RemoveSettingsProvider(CrosSettingsProvider* provider) {
131 DCHECK(CalledOnValidThread()); 139 DCHECK(CalledOnValidThread());
132 std::vector<CrosSettingsProvider*>::iterator it = 140 std::vector<CrosSettingsProvider*>::iterator it =
133 std::find(providers_.begin(), providers_.end(), provider); 141 std::find(providers_.begin(), providers_.end(), provider);
134 if (it != providers_.end()) { 142 if (it != providers_.end()) {
135 providers_.erase(it); 143 providers_.erase(it);
136 return true; 144 return true;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // System settings are not mocked currently. 286 // System settings are not mocked currently.
279 AddSettingsProvider(new SystemSettingsProvider(notify_cb)); 287 AddSettingsProvider(new SystemSettingsProvider(notify_cb));
280 } 288 }
281 289
282 CrosSettings::~CrosSettings() { 290 CrosSettings::~CrosSettings() {
283 STLDeleteElements(&providers_); 291 STLDeleteElements(&providers_);
284 STLDeleteValues(&settings_observers_); 292 STLDeleteValues(&settings_observers_);
285 } 293 }
286 294
287 } // namespace chromeos 295 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/app/policy/policy_templates.json ('k') | chrome/browser/chromeos/cros_settings_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698