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