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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 virtual void OnStateChanged(const std::string& extension_id, | 62 virtual void OnStateChanged(const std::string& extension_id, |
63 IdleState new_state) = 0; | 63 IdleState new_state) = 0; |
64 virtual void RegisterObserver(EventRouter::Observer* observer) = 0; | 64 virtual void RegisterObserver(EventRouter::Observer* observer) = 0; |
65 virtual void UnregisterObserver(EventRouter::Observer* observer) = 0; | 65 virtual void UnregisterObserver(EventRouter::Observer* observer) = 0; |
66 | 66 |
67 private: | 67 private: |
68 DISALLOW_COPY_AND_ASSIGN(EventDelegate); | 68 DISALLOW_COPY_AND_ASSIGN(EventDelegate); |
69 }; | 69 }; |
70 | 70 |
71 explicit IdleManager(Profile* profile); | 71 explicit IdleManager(Profile* profile); |
72 virtual ~IdleManager(); | 72 ~IdleManager() override; |
73 | 73 |
74 void Init(); | 74 void Init(); |
75 | 75 |
76 // KeyedService implementation. | 76 // KeyedService implementation. |
77 virtual void Shutdown() override; | 77 void Shutdown() override; |
78 | 78 |
79 // ExtensionRegistryObserver implementation. | 79 // ExtensionRegistryObserver implementation. |
80 virtual void OnExtensionUnloaded( | 80 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
81 content::BrowserContext* browser_context, | 81 const Extension* extension, |
82 const Extension* extension, | 82 UnloadedExtensionInfo::Reason reason) override; |
83 UnloadedExtensionInfo::Reason reason) override; | |
84 | 83 |
85 // EventRouter::Observer implementation. | 84 // EventRouter::Observer implementation. |
86 virtual void OnListenerAdded(const EventListenerInfo& details) override; | 85 void OnListenerAdded(const EventListenerInfo& details) override; |
87 virtual void OnListenerRemoved(const EventListenerInfo& details) override; | 86 void OnListenerRemoved(const EventListenerInfo& details) override; |
88 | 87 |
89 void QueryState(int threshold, QueryStateCallback notify); | 88 void QueryState(int threshold, QueryStateCallback notify); |
90 void SetThreshold(const std::string& extension_id, int threshold); | 89 void SetThreshold(const std::string& extension_id, int threshold); |
91 static base::StringValue* CreateIdleValue(IdleState idle_state); | 90 static base::StringValue* CreateIdleValue(IdleState idle_state); |
92 | 91 |
93 // Override default event class. Callee assumes ownership. Used for testing. | 92 // Override default event class. Callee assumes ownership. Used for testing. |
94 void SetEventDelegateForTest(scoped_ptr<EventDelegate> event_delegate); | 93 void SetEventDelegateForTest(scoped_ptr<EventDelegate> event_delegate); |
95 | 94 |
96 // Override default idle time calculations. Callee assumes ownership. Used | 95 // Override default idle time calculations. Callee assumes ownership. Used |
97 // for testing. | 96 // for testing. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 extension_registry_observer_; | 136 extension_registry_observer_; |
138 | 137 |
139 base::WeakPtrFactory<IdleManager> weak_factory_; | 138 base::WeakPtrFactory<IdleManager> weak_factory_; |
140 | 139 |
141 DISALLOW_COPY_AND_ASSIGN(IdleManager); | 140 DISALLOW_COPY_AND_ASSIGN(IdleManager); |
142 }; | 141 }; |
143 | 142 |
144 } // namespace extensions | 143 } // namespace extensions |
145 | 144 |
146 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ | 145 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_MANAGER_H_ |
OLD | NEW |