| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // The AppWindowRegistry tracks the AppWindows for all platform apps for a | 31 // The AppWindowRegistry tracks the AppWindows for all platform apps for a |
| 32 // particular browser context. | 32 // particular browser context. |
| 33 class AppWindowRegistry : public KeyedService, | 33 class AppWindowRegistry : public KeyedService, |
| 34 public content::DevToolsAgentHostObserver { | 34 public content::DevToolsAgentHostObserver { |
| 35 public: | 35 public: |
| 36 class Observer { | 36 class Observer { |
| 37 public: | 37 public: |
| 38 // Called just after a app window was added. | 38 // Called just after a app window was added. |
| 39 virtual void OnAppWindowAdded(AppWindow* app_window); | 39 virtual void OnAppWindowAdded(AppWindow* app_window); |
| 40 // Called when the window icon changes. | |
| 41 virtual void OnAppWindowIconChanged(AppWindow* app_window); | |
| 42 // Called just after a app window was removed. | 40 // Called just after a app window was removed. |
| 43 virtual void OnAppWindowRemoved(AppWindow* app_window); | 41 virtual void OnAppWindowRemoved(AppWindow* app_window); |
| 44 // Called just after a app window was hidden. This is different from | 42 // Called just after a app window was hidden. This is different from |
| 45 // window visibility as a minimize does not hide a window, but does make | 43 // window visibility as a minimize does not hide a window, but does make |
| 46 // it not visible. | 44 // it not visible. |
| 47 virtual void OnAppWindowHidden(AppWindow* app_window); | 45 virtual void OnAppWindowHidden(AppWindow* app_window); |
| 48 // Called just after a app window was shown. | 46 // Called just after a app window was shown. |
| 49 virtual void OnAppWindowShown(AppWindow* app_window, bool was_hidden); | 47 virtual void OnAppWindowShown(AppWindow* app_window, bool was_hidden); |
| 50 // Called just after a app window was activated. | 48 // Called just after a app window was activated. |
| 51 virtual void OnAppWindowActivated(AppWindow* app_window); | 49 virtual void OnAppWindowActivated(AppWindow* app_window); |
| 52 | 50 |
| 53 protected: | 51 protected: |
| 54 virtual ~Observer(); | 52 virtual ~Observer(); |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 typedef std::list<AppWindow*> AppWindowList; | 55 typedef std::list<AppWindow*> AppWindowList; |
| 58 typedef AppWindowList::const_iterator const_iterator; | 56 typedef AppWindowList::const_iterator const_iterator; |
| 59 typedef std::set<std::string> InspectedWindowSet; | 57 typedef std::set<std::string> InspectedWindowSet; |
| 60 | 58 |
| 61 explicit AppWindowRegistry(content::BrowserContext* context); | 59 explicit AppWindowRegistry(content::BrowserContext* context); |
| 62 ~AppWindowRegistry() override; | 60 ~AppWindowRegistry() override; |
| 63 | 61 |
| 64 // Returns the instance for the given browser context, or NULL if none. This | 62 // Returns the instance for the given browser context, or NULL if none. This |
| 65 // is a convenience wrapper around | 63 // is a convenience wrapper around |
| 66 // AppWindowRegistry::Factory::GetForBrowserContext(). | 64 // AppWindowRegistry::Factory::GetForBrowserContext(). |
| 67 static AppWindowRegistry* Get(content::BrowserContext* context); | 65 static AppWindowRegistry* Get(content::BrowserContext* context); |
| 68 | 66 |
| 69 void AddAppWindow(AppWindow* app_window); | 67 void AddAppWindow(AppWindow* app_window); |
| 70 void AppWindowIconChanged(AppWindow* app_window); | |
| 71 // Called by |app_window| when it is activated. | 68 // Called by |app_window| when it is activated. |
| 72 void AppWindowActivated(AppWindow* app_window); | 69 void AppWindowActivated(AppWindow* app_window); |
| 73 void AppWindowHidden(AppWindow* app_window); | 70 void AppWindowHidden(AppWindow* app_window); |
| 74 void AppWindowShown(AppWindow* app_window, bool was_hidden); | 71 void AppWindowShown(AppWindow* app_window, bool was_hidden); |
| 75 void RemoveAppWindow(AppWindow* app_window); | 72 void RemoveAppWindow(AppWindow* app_window); |
| 76 | 73 |
| 77 void AddObserver(Observer* observer); | 74 void AddObserver(Observer* observer); |
| 78 void RemoveObserver(Observer* observer); | 75 void RemoveObserver(Observer* observer); |
| 79 | 76 |
| 80 // Returns a set of windows owned by the application identified by app_id. | 77 // Returns a set of windows owned by the application identified by app_id. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 151 |
| 155 content::BrowserContext* context_; | 152 content::BrowserContext* context_; |
| 156 AppWindowList app_windows_; | 153 AppWindowList app_windows_; |
| 157 InspectedWindowSet inspected_windows_; | 154 InspectedWindowSet inspected_windows_; |
| 158 base::ObserverList<Observer> observers_; | 155 base::ObserverList<Observer> observers_; |
| 159 }; | 156 }; |
| 160 | 157 |
| 161 } // namespace extensions | 158 } // namespace extensions |
| 162 | 159 |
| 163 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ | 160 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_REGISTRY_H_ |
| OLD | NEW |