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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // user session. On the login screen, user settings are cleared when the user | 27 // user session. On the login screen, user settings are cleared when the user |
28 // becomes idle for one minute. | 28 // becomes idle for one minute. |
29 class RecommendationRestorer : public KeyedService, | 29 class RecommendationRestorer : public KeyedService, |
30 public content::NotificationObserver, | 30 public content::NotificationObserver, |
31 public wm::UserActivityObserver { | 31 public wm::UserActivityObserver { |
32 public: | 32 public: |
33 explicit RecommendationRestorer(Profile* profile); | 33 explicit RecommendationRestorer(Profile* profile); |
34 virtual ~RecommendationRestorer(); | 34 virtual ~RecommendationRestorer(); |
35 | 35 |
36 // KeyedService: | 36 // KeyedService: |
37 virtual void Shutdown() OVERRIDE; | 37 virtual void Shutdown() override; |
38 | 38 |
39 // content::NotificationObserver: | 39 // content::NotificationObserver: |
40 virtual void Observe(int type, | 40 virtual void Observe(int type, |
41 const content::NotificationSource& source, | 41 const content::NotificationSource& source, |
42 const content::NotificationDetails& details) OVERRIDE; | 42 const content::NotificationDetails& details) override; |
43 | 43 |
44 // wm::UserActivityObserver: | 44 // wm::UserActivityObserver: |
45 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; | 45 virtual void OnUserActivity(const ui::Event* event) override; |
46 | 46 |
47 // If a recommended value and a user setting exist for |pref_name|, clears the | 47 // If a recommended value and a user setting exist for |pref_name|, clears the |
48 // user setting so that the recommended value can take effect. If | 48 // user setting so that the recommended value can take effect. If |
49 // |allow_delay| is |true| and the login screen is being shown, a timer is | 49 // |allow_delay| is |true| and the login screen is being shown, a timer is |
50 // started that will clear the setting when the user becomes idle for one | 50 // started that will clear the setting when the user becomes idle for one |
51 // minute. Otherwise, the setting is cleared immediately. | 51 // minute. Otherwise, the setting is cleared immediately. |
52 void Restore(bool allow_delay, const std::string& pref_name); | 52 void Restore(bool allow_delay, const std::string& pref_name); |
53 | 53 |
54 private: | 54 private: |
55 friend class RecommendationRestorerTest; | 55 friend class RecommendationRestorerTest; |
56 | 56 |
57 void RestoreAll(); | 57 void RestoreAll(); |
58 | 58 |
59 void StartTimer(); | 59 void StartTimer(); |
60 void StopTimer(); | 60 void StopTimer(); |
61 | 61 |
62 PrefChangeRegistrar pref_change_registrar_; | 62 PrefChangeRegistrar pref_change_registrar_; |
63 content::NotificationRegistrar notification_registrar_; | 63 content::NotificationRegistrar notification_registrar_; |
64 | 64 |
65 bool logged_in_; | 65 bool logged_in_; |
66 | 66 |
67 base::OneShotTimer<RecommendationRestorer> restore_timer_; | 67 base::OneShotTimer<RecommendationRestorer> restore_timer_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(RecommendationRestorer); | 69 DISALLOW_COPY_AND_ASSIGN(RecommendationRestorer); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace policy | 72 } // namespace policy |
73 | 73 |
74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |
OLD | NEW |