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