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_TABS_TABS_WINDOWS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
11 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 11 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
| 14 class TabsEventRouter; |
14 class WindowsEventRouter; | 15 class WindowsEventRouter; |
15 | 16 |
16 class TabsWindowsAPI : public ProfileKeyedAPI, | 17 class TabsWindowsAPI : public ProfileKeyedAPI, public EventRouter::Observer { |
17 public extensions::EventRouter::Observer { | |
18 public: | 18 public: |
19 explicit TabsWindowsAPI(Profile* profile); | 19 explicit TabsWindowsAPI(Profile* profile); |
20 virtual ~TabsWindowsAPI(); | 20 virtual ~TabsWindowsAPI(); |
21 | 21 |
22 // Convenience method to get the TabsWindowsAPI for a profile. | 22 // Convenience method to get the TabsWindowsAPI for a profile. |
23 static TabsWindowsAPI* Get(Profile* profile); | 23 static TabsWindowsAPI* Get(Profile* profile); |
24 | 24 |
| 25 TabsEventRouter* tabs_event_router(); |
25 WindowsEventRouter* windows_event_router(); | 26 WindowsEventRouter* windows_event_router(); |
26 | 27 |
27 // BrowserContextKeyedService implementation. | 28 // BrowserContextKeyedService implementation. |
28 virtual void Shutdown() OVERRIDE; | 29 virtual void Shutdown() OVERRIDE; |
29 | 30 |
30 // ProfileKeyedAPI implementation. | 31 // ProfileKeyedAPI implementation. |
31 static ProfileKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); | 32 static ProfileKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); |
32 | 33 |
33 // EventRouter::Observer implementation. | 34 // EventRouter::Observer implementation. |
34 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | 35 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
35 OVERRIDE; | 36 OVERRIDE; |
36 | 37 |
37 private: | 38 private: |
38 friend class ProfileKeyedAPIFactory<TabsWindowsAPI>; | 39 friend class ProfileKeyedAPIFactory<TabsWindowsAPI>; |
39 | 40 |
40 Profile* profile_; | 41 Profile* profile_; |
41 | 42 |
42 // ProfileKeyedAPI implementation. | 43 // ProfileKeyedAPI implementation. |
43 static const char* service_name() { | 44 static const char* service_name() { |
44 return "TabsWindowsAPI"; | 45 return "TabsWindowsAPI"; |
45 } | 46 } |
46 static const bool kServiceIsNULLWhileTesting = true; | 47 static const bool kServiceIsNULLWhileTesting = true; |
47 | 48 |
| 49 scoped_ptr<TabsEventRouter> tabs_event_router_; |
48 scoped_ptr<WindowsEventRouter> windows_event_router_; | 50 scoped_ptr<WindowsEventRouter> windows_event_router_; |
49 }; | 51 }; |
50 | 52 |
51 } // namespace extensions | 53 } // namespace extensions |
52 | 54 |
53 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ |
OLD | NEW |