OLD | NEW |
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/policy/recommendation_restorer.h" | 5 #include "chrome/browser/chromeos/policy/recommendation_restorer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/user_activity_detector.h" | 8 #include "ash/wm/user_activity_detector.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace policy { | 24 namespace policy { |
25 | 25 |
26 namespace { | 26 namespace { |
27 // The amount of idle time after which recommended values are restored. | 27 // The amount of idle time after which recommended values are restored. |
28 const int kRestoreDelayInMs = 60 * 1000; // 1 minute. | 28 const int kRestoreDelayInMs = 60 * 1000; // 1 minute. |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 RecommendationRestorer::RecommendationRestorer(Profile* profile) | 31 RecommendationRestorer::RecommendationRestorer(Profile* profile) |
32 : logged_in_(false) { | 32 : logged_in_(false) { |
33 if (!chromeos::ProfileHelper::IsSigninProfile(profile)) | 33 if (!profile->IsLoginProfile()) |
34 return; | 34 return; |
35 | 35 |
36 pref_change_registrar_.Init(profile->GetPrefs()); | 36 pref_change_registrar_.Init(profile->GetPrefs()); |
37 pref_change_registrar_.Add(prefs::kLargeCursorEnabled, | 37 pref_change_registrar_.Add(prefs::kLargeCursorEnabled, |
38 base::Bind(&RecommendationRestorer::Restore, | 38 base::Bind(&RecommendationRestorer::Restore, |
39 base::Unretained(this), true)); | 39 base::Unretained(this), true)); |
40 pref_change_registrar_.Add(prefs::kSpokenFeedbackEnabled, | 40 pref_change_registrar_.Add(prefs::kSpokenFeedbackEnabled, |
41 base::Bind(&RecommendationRestorer::Restore, | 41 base::Bind(&RecommendationRestorer::Restore, |
42 base::Unretained(this), true)); | 42 base::Unretained(this), true)); |
43 pref_change_registrar_.Add(prefs::kHighContrastEnabled, | 43 pref_change_registrar_.Add(prefs::kHighContrastEnabled, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 base::Unretained(this))); | 144 base::Unretained(this))); |
145 } | 145 } |
146 | 146 |
147 void RecommendationRestorer::StopTimer() { | 147 void RecommendationRestorer::StopTimer() { |
148 restore_timer_.Stop(); | 148 restore_timer_.Stop(); |
149 if (ash::Shell::HasInstance()) | 149 if (ash::Shell::HasInstance()) |
150 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); | 150 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); |
151 } | 151 } |
152 | 152 |
153 } // namespace policy | 153 } // namespace policy |
OLD | NEW |