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

Side by Side Diff: chrome/browser/chromeos/power/power_prefs.cc

Issue 129193002: Revert of chromeos: Don't send empty power management policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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 "chrome/browser/chromeos/power/power_prefs.h" 5 #include "chrome/browser/chromeos/power/power_prefs.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 void PowerPrefs::SetProfile(Profile* profile) { 231 void PowerPrefs::SetProfile(Profile* profile) {
232 // No need to reapply policy if profile hasn't changed, e.g. when adding a 232 // No need to reapply policy if profile hasn't changed, e.g. when adding a
233 // secondary user to an existing session. 233 // secondary user to an existing session.
234 if (profile == profile_) 234 if (profile == profile_)
235 return; 235 return;
236 236
237 profile_ = profile; 237 profile_ = profile;
238 pref_change_registrar_.reset(); 238 pref_change_registrar_.reset();
239 239
240 if (!profile) 240 if (!profile) {
241 power_policy_controller_->ClearPrefs();
241 return; 242 return;
243 }
242 244
243 base::Closure update_callback(base::Bind( 245 base::Closure update_callback(base::Bind(
244 &PowerPrefs::UpdatePowerPolicyFromPrefs, 246 &PowerPrefs::UpdatePowerPolicyFromPrefs,
245 base::Unretained(this))); 247 base::Unretained(this)));
246 pref_change_registrar_.reset(new PrefChangeRegistrar); 248 pref_change_registrar_.reset(new PrefChangeRegistrar);
247 pref_change_registrar_->Init(profile->GetPrefs()); 249 pref_change_registrar_->Init(profile->GetPrefs());
248 pref_change_registrar_->Add(prefs::kPowerAcScreenDimDelayMs, update_callback); 250 pref_change_registrar_->Add(prefs::kPowerAcScreenDimDelayMs, update_callback);
249 pref_change_registrar_->Add(prefs::kPowerAcScreenOffDelayMs, update_callback); 251 pref_change_registrar_->Add(prefs::kPowerAcScreenOffDelayMs, update_callback);
250 pref_change_registrar_->Add(prefs::kPowerAcScreenLockDelayMs, 252 pref_change_registrar_->Add(prefs::kPowerAcScreenLockDelayMs,
251 update_callback); 253 update_callback);
(...skipping 21 matching lines...) Expand all
273 update_callback); 275 update_callback);
274 pref_change_registrar_->Add(prefs::kPowerUserActivityScreenDimDelayFactor, 276 pref_change_registrar_->Add(prefs::kPowerUserActivityScreenDimDelayFactor,
275 update_callback); 277 update_callback);
276 pref_change_registrar_->Add(prefs::kPowerWaitForInitialUserActivity, 278 pref_change_registrar_->Add(prefs::kPowerWaitForInitialUserActivity,
277 update_callback); 279 update_callback);
278 280
279 UpdatePowerPolicyFromPrefs(); 281 UpdatePowerPolicyFromPrefs();
280 } 282 }
281 283
282 } // namespace chromeos 284 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/power_policy_browsertest.cc ('k') | chrome/browser/chromeos/power/power_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698