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

Side by Side Diff: chrome/browser/extensions/api/idle/idle_manager.h

Issue 197413002: Move extensions-related files to using //components/keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 (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
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "chrome/browser/idle.h" 16 #include "chrome/browser/idle.h"
17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 17 #include "components/keyed_service/core/keyed_service.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
21 21
22 namespace base { 22 namespace base {
23 class StringValue; 23 class StringValue;
24 } // namespace base 24 } // namespace base
25 25
26 class Profile; 26 class Profile;
27 27
28 namespace extensions { 28 namespace extensions {
29 29
30 typedef base::Callback<void(IdleState)> QueryStateCallback; 30 typedef base::Callback<void(IdleState)> QueryStateCallback;
31 31
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 BrowserContextKeyedService { 42 public KeyedService {
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
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 // BrowserContextKeyedService implementation. 75 // KeyedService 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
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_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/idle/idle_api_unittest.cc ('k') | chrome/browser/extensions/api/idle/idle_manager_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698