OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 struct IdleMonitor { | 32 struct IdleMonitor { |
33 explicit IdleMonitor(IdleState initial_state); | 33 explicit IdleMonitor(IdleState initial_state); |
34 | 34 |
35 IdleState last_state; | 35 IdleState last_state; |
36 int listeners; | 36 int listeners; |
37 int threshold; | 37 int threshold; |
38 }; | 38 }; |
39 | 39 |
40 class IdleManager : public content::NotificationObserver, | 40 class IdleManager : public content::NotificationObserver, |
41 public EventRouter::Observer, | 41 public EventRouter::Observer, |
42 public ProfileKeyedService { | 42 public BrowserContextKeyedService { |
43 public: | 43 public: |
44 class IdleTimeProvider { | 44 class IdleTimeProvider { |
45 public: | 45 public: |
46 IdleTimeProvider() {} | 46 IdleTimeProvider() {} |
47 virtual ~IdleTimeProvider() {} | 47 virtual ~IdleTimeProvider() {} |
48 virtual void CalculateIdleState(int idle_threshold, | 48 virtual void CalculateIdleState(int idle_threshold, |
49 IdleCallback notify) = 0; | 49 IdleCallback notify) = 0; |
50 virtual void CalculateIdleTime(IdleTimeCallback notify) = 0; | 50 virtual void CalculateIdleTime(IdleTimeCallback notify) = 0; |
51 virtual bool CheckIdleStateIsLocked() = 0; | 51 virtual bool CheckIdleStateIsLocked() = 0; |
52 | 52 |
(...skipping 12 matching lines...) Expand all Loading... |
65 | 65 |
66 private: | 66 private: |
67 DISALLOW_COPY_AND_ASSIGN(EventDelegate); | 67 DISALLOW_COPY_AND_ASSIGN(EventDelegate); |
68 }; | 68 }; |
69 | 69 |
70 explicit IdleManager(Profile* profile); | 70 explicit IdleManager(Profile* profile); |
71 virtual ~IdleManager(); | 71 virtual ~IdleManager(); |
72 | 72 |
73 void Init(); | 73 void Init(); |
74 | 74 |
75 // ProfileKeyedService implementation. | 75 // BrowserContextKeyedService implementation. |
76 virtual void Shutdown() OVERRIDE; | 76 virtual void Shutdown() OVERRIDE; |
77 | 77 |
78 // content::NotificationDelegate implementation. | 78 // content::NotificationDelegate implementation. |
79 virtual void Observe(int type, | 79 virtual void Observe(int type, |
80 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
81 const content::NotificationDetails& details) OVERRIDE; | 81 const content::NotificationDetails& details) OVERRIDE; |
82 | 82 |
83 // EventRouter::Observer implementation. | 83 // EventRouter::Observer implementation. |
84 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 84 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
85 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 85 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 scoped_ptr<EventDelegate> event_delegate_; | 130 scoped_ptr<EventDelegate> event_delegate_; |
131 | 131 |
132 base::ThreadChecker thread_checker_; | 132 base::ThreadChecker thread_checker_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(IdleManager); | 134 DISALLOW_COPY_AND_ASSIGN(IdleManager); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace extensions | 137 } // namespace extensions |
138 | 138 |
139 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ | 139 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ |
OLD | NEW |