| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ |
| 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~Observer(); | 50 virtual ~Observer(); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 typedef std::list<AppWindow*> AppWindowList; | 53 typedef std::list<AppWindow*> AppWindowList; |
| 54 typedef AppWindowList::const_iterator const_iterator; | 54 typedef AppWindowList::const_iterator const_iterator; |
| 55 typedef std::set<std::string> InspectedWindowSet; | 55 typedef std::set<std::string> InspectedWindowSet; |
| 56 | 56 |
| 57 explicit AppWindowRegistry(content::BrowserContext* context); | 57 explicit AppWindowRegistry(content::BrowserContext* context); |
| 58 virtual ~AppWindowRegistry(); | 58 ~AppWindowRegistry() override; |
| 59 | 59 |
| 60 // Returns the instance for the given browser context, or NULL if none. This | 60 // Returns the instance for the given browser context, or NULL if none. This |
| 61 // is a convenience wrapper around | 61 // is a convenience wrapper around |
| 62 // AppWindowRegistry::Factory::GetForBrowserContext(). | 62 // AppWindowRegistry::Factory::GetForBrowserContext(). |
| 63 static AppWindowRegistry* Get(content::BrowserContext* context); | 63 static AppWindowRegistry* Get(content::BrowserContext* context); |
| 64 | 64 |
| 65 void AddAppWindow(AppWindow* app_window); | 65 void AddAppWindow(AppWindow* app_window); |
| 66 void AppWindowIconChanged(AppWindow* app_window); | 66 void AppWindowIconChanged(AppWindow* app_window); |
| 67 // Called by |app_window| when it is activated. | 67 // Called by |app_window| when it is activated. |
| 68 void AppWindowActivated(AppWindow* app_window); | 68 void AppWindowActivated(AppWindow* app_window); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 static AppWindowRegistry* GetForBrowserContext( | 105 static AppWindowRegistry* GetForBrowserContext( |
| 106 content::BrowserContext* context, | 106 content::BrowserContext* context, |
| 107 bool create); | 107 bool create); |
| 108 | 108 |
| 109 static Factory* GetInstance(); | 109 static Factory* GetInstance(); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 friend struct DefaultSingletonTraits<Factory>; | 112 friend struct DefaultSingletonTraits<Factory>; |
| 113 | 113 |
| 114 Factory(); | 114 Factory(); |
| 115 virtual ~Factory(); | 115 ~Factory() override; |
| 116 | 116 |
| 117 // BrowserContextKeyedServiceFactory | 117 // BrowserContextKeyedServiceFactory |
| 118 virtual KeyedService* BuildServiceInstanceFor( | 118 KeyedService* BuildServiceInstanceFor( |
| 119 content::BrowserContext* context) const override; | 119 content::BrowserContext* context) const override; |
| 120 virtual bool ServiceIsCreatedWithBrowserContext() const override; | 120 bool ServiceIsCreatedWithBrowserContext() const override; |
| 121 virtual bool ServiceIsNULLWhileTesting() const override; | 121 bool ServiceIsNULLWhileTesting() const override; |
| 122 virtual content::BrowserContext* GetBrowserContextToUse( | 122 content::BrowserContext* GetBrowserContextToUse( |
| 123 content::BrowserContext* context) const override; | 123 content::BrowserContext* context) const override; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 protected: | 126 protected: |
| 127 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); | 127 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 // Ensures the specified |app_window| is included in |app_windows_|. | 130 // Ensures the specified |app_window| is included in |app_windows_|. |
| 131 // Otherwise adds |app_window| to the back of |app_windows_|. | 131 // Otherwise adds |app_window| to the back of |app_windows_|. |
| 132 void AddAppWindowToList(AppWindow* app_window); | 132 void AddAppWindowToList(AppWindow* app_window); |
| 133 | 133 |
| 134 // Bring |app_window| to the front of |app_windows_|. If it is not in the | 134 // Bring |app_window| to the front of |app_windows_|. If it is not in the |
| 135 // list, add it first. | 135 // list, add it first. |
| 136 void BringToFront(AppWindow* app_window); | 136 void BringToFront(AppWindow* app_window); |
| 137 | 137 |
| 138 content::BrowserContext* context_; | 138 content::BrowserContext* context_; |
| 139 AppWindowList app_windows_; | 139 AppWindowList app_windows_; |
| 140 InspectedWindowSet inspected_windows_; | 140 InspectedWindowSet inspected_windows_; |
| 141 ObserverList<Observer> observers_; | 141 ObserverList<Observer> observers_; |
| 142 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 142 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace extensions | 145 } // namespace extensions |
| 146 | 146 |
| 147 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ | 147 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ |
| OLD | NEW |