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