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