| 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 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 // BrowserContextKeyedService implementation. |
| 28 virtual void Shutdown() OVERRIDE; | 28 virtual void Shutdown() OVERRIDE; |
| 29 | 29 |
| 30 // ProfileKeyedAPI implementation. | 30 // ProfileKeyedAPI implementation. |
| 31 static ProfileKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); | 31 static ProfileKeyedAPIFactory<TabsWindowsAPI>* GetFactoryInstance(); |
| 32 | 32 |
| 33 // EventRouter::Observer implementation. | 33 // EventRouter::Observer implementation. |
| 34 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | 34 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
| 35 OVERRIDE; | 35 OVERRIDE; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 friend class ProfileKeyedAPIFactory<TabsWindowsAPI>; | 38 friend class ProfileKeyedAPIFactory<TabsWindowsAPI>; |
| 39 | 39 |
| 40 Profile* profile_; | 40 Profile* profile_; |
| 41 | 41 |
| 42 // ProfileKeyedAPI implementation. | 42 // ProfileKeyedAPI implementation. |
| 43 static const char* service_name() { | 43 static const char* service_name() { |
| 44 return "TabsWindowsAPI"; | 44 return "TabsWindowsAPI"; |
| 45 } | 45 } |
| 46 static const bool kServiceIsNULLWhileTesting = true; | 46 static const bool kServiceIsNULLWhileTesting = true; |
| 47 | 47 |
| 48 scoped_ptr<WindowsEventRouter> windows_event_router_; | 48 scoped_ptr<WindowsEventRouter> windows_event_router_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace extensions | 51 } // namespace extensions |
| 52 | 52 |
| 53 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ | 53 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_ |
| OLD | NEW |