| 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 EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | |
| 10 #include <string> | 9 #include <string> |
| 11 | 10 |
| 12 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 13 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
| 17 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 18 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 18 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 83 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 85 const Extension* extension, | 84 const Extension* extension, |
| 86 UnloadedExtensionInfo::Reason reason) override; | 85 UnloadedExtensionInfo::Reason reason) override; |
| 87 | 86 |
| 88 // EventRouter::Observer implementation. | 87 // EventRouter::Observer implementation. |
| 89 void OnListenerAdded(const EventListenerInfo& details) override; | 88 void OnListenerAdded(const EventListenerInfo& details) override; |
| 90 void OnListenerRemoved(const EventListenerInfo& details) override; | 89 void OnListenerRemoved(const EventListenerInfo& details) override; |
| 91 | 90 |
| 92 void QueryState(int threshold, QueryStateCallback notify); | 91 void QueryState(int threshold, QueryStateCallback notify); |
| 93 void SetThreshold(const std::string& extension_id, int threshold); | 92 void SetThreshold(const std::string& extension_id, int threshold); |
| 94 static std::unique_ptr<base::StringValue> CreateIdleValue( | 93 static base::StringValue* CreateIdleValue(ui::IdleState idle_state); |
| 95 ui::IdleState idle_state); | |
| 96 | 94 |
| 97 // Override default event class. Callee assumes ownership. Used for testing. | 95 // Override default event class. Callee assumes ownership. Used for testing. |
| 98 void SetEventDelegateForTest(std::unique_ptr<EventDelegate> event_delegate); | 96 void SetEventDelegateForTest(std::unique_ptr<EventDelegate> event_delegate); |
| 99 | 97 |
| 100 // Override default idle time calculations. Callee assumes ownership. Used | 98 // Override default idle time calculations. Callee assumes ownership. Used |
| 101 // for testing. | 99 // for testing. |
| 102 void SetIdleTimeProviderForTest( | 100 void SetIdleTimeProviderForTest( |
| 103 std::unique_ptr<IdleTimeProvider> idle_provider); | 101 std::unique_ptr<IdleTimeProvider> idle_provider); |
| 104 | 102 |
| 105 private: | 103 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 extension_registry_observer_; | 140 extension_registry_observer_; |
| 143 | 141 |
| 144 base::WeakPtrFactory<IdleManager> weak_factory_; | 142 base::WeakPtrFactory<IdleManager> weak_factory_; |
| 145 | 143 |
| 146 DISALLOW_COPY_AND_ASSIGN(IdleManager); | 144 DISALLOW_COPY_AND_ASSIGN(IdleManager); |
| 147 }; | 145 }; |
| 148 | 146 |
| 149 } // namespace extensions | 147 } // namespace extensions |
| 150 | 148 |
| 151 #endif // EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ | 149 #endif // EXTENSIONS_BROWSER_API_IDLE_IDLE_MANAGER_H_ |
| OLD | NEW |