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

Side by Side Diff: chrome/browser/chromeos/policy/recommendation_restorer.h

Issue 222383002: Move UserActivityDetector from ash/wm/ to ui/wm/core/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove an unneeded include Created 6 years, 8 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 #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 "ash/wm/user_activity_observer.h"
11 #include "base/basictypes.h" 10 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/prefs/pref_change_registrar.h" 12 #include "base/prefs/pref_change_registrar.h"
14 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
15 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
16 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "ui/wm/core/user_activity_observer.h"
18 18
19 class Profile; 19 class Profile;
20 20
21 namespace policy { 21 namespace policy {
22 22
23 // Observes a set of prefs in the login profile. If any of the prefs has a 23 // Observes a set of prefs in the login profile. If any of the prefs has a
24 // recommended value, its user setting is cleared so that the recommendation can 24 // recommended value, its user setting is cleared so that the recommendation can
25 // take effect. This happens immediately when the login screen is shown, when 25 // take effect. This happens immediately when the login screen is shown, when
26 // a session is being started and whenever recommended values change during a 26 // a session is being started and whenever recommended values change during a
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 ash::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 // ash::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:
(...skipping 10 matching lines...) Expand all
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698