| 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_SHELL_WINDOW_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // page, shell windows, tray view, panels etc.) and other app level behaviour | 32 // page, shell windows, tray view, panels etc.) and other app level behaviour |
| 33 // (e.g. notifications the app is interested in, lifetime of the background | 33 // (e.g. notifications the app is interested in, lifetime of the background |
| 34 // page). | 34 // page). |
| 35 class ShellWindowRegistry : public ProfileKeyedService, | 35 class ShellWindowRegistry : public ProfileKeyedService, |
| 36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
| 37 public: | 37 public: |
| 38 class Observer { | 38 class Observer { |
| 39 public: | 39 public: |
| 40 // Called just after a shell window was added. | 40 // Called just after a shell window was added. |
| 41 virtual void OnShellWindowAdded(ShellWindow* shell_window) = 0; | 41 virtual void OnShellWindowAdded(ShellWindow* shell_window) = 0; |
| 42 // Called when the window icon changes. |
| 43 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) = 0; |
| 42 // Called just after a shell window was removed. | 44 // Called just after a shell window was removed. |
| 43 virtual void OnShellWindowRemoved(ShellWindow* shell_window) = 0; | 45 virtual void OnShellWindowRemoved(ShellWindow* shell_window) = 0; |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 virtual ~Observer() {} | 48 virtual ~Observer() {} |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 typedef std::set<ShellWindow*> ShellWindowSet; | 51 typedef std::set<ShellWindow*> ShellWindowSet; |
| 50 typedef ShellWindowSet::const_iterator const_iterator; | 52 typedef ShellWindowSet::const_iterator const_iterator; |
| 51 typedef std::set<std::string> InspectedWindowSet; | 53 typedef std::set<std::string> InspectedWindowSet; |
| 52 | 54 |
| 53 explicit ShellWindowRegistry(Profile* profile); | 55 explicit ShellWindowRegistry(Profile* profile); |
| 54 virtual ~ShellWindowRegistry(); | 56 virtual ~ShellWindowRegistry(); |
| 55 | 57 |
| 56 // Returns the instance for the given profile, or NULL if none. This is | 58 // Returns the instance for the given profile, or NULL if none. This is |
| 57 // a convenience wrapper around ShellWindowRegistry::Factory::GetForProfile. | 59 // a convenience wrapper around ShellWindowRegistry::Factory::GetForProfile. |
| 58 static ShellWindowRegistry* Get(Profile* profile); | 60 static ShellWindowRegistry* Get(Profile* profile); |
| 59 | 61 |
| 60 void AddShellWindow(ShellWindow* shell_window); | 62 void AddShellWindow(ShellWindow* shell_window); |
| 63 void ShellWindowIconChanged(ShellWindow* shell_window); |
| 61 void RemoveShellWindow(ShellWindow* shell_window); | 64 void RemoveShellWindow(ShellWindow* shell_window); |
| 62 | 65 |
| 63 void AddObserver(Observer* observer); | 66 void AddObserver(Observer* observer); |
| 64 void RemoveObserver(Observer* observer); | 67 void RemoveObserver(Observer* observer); |
| 65 | 68 |
| 66 // Returns a set of windows owned by the application identified by app_id. | 69 // Returns a set of windows owned by the application identified by app_id. |
| 67 ShellWindowSet GetShellWindowsForApp(const std::string& app_id) const; | 70 ShellWindowSet GetShellWindowsForApp(const std::string& app_id) const; |
| 68 const ShellWindowSet& shell_windows() const { return shell_windows_; } | 71 const ShellWindowSet& shell_windows() const { return shell_windows_; } |
| 69 | 72 |
| 70 // Helper functions to find shell windows with particular attributes. | 73 // Helper functions to find shell windows with particular attributes. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 112 |
| 110 ShellWindowSet shell_windows_; | 113 ShellWindowSet shell_windows_; |
| 111 InspectedWindowSet inspected_windows_; | 114 InspectedWindowSet inspected_windows_; |
| 112 ObserverList<Observer> observers_; | 115 ObserverList<Observer> observers_; |
| 113 content::NotificationRegistrar registrar_; | 116 content::NotificationRegistrar registrar_; |
| 114 }; | 117 }; |
| 115 | 118 |
| 116 } // namespace extensions | 119 } // namespace extensions |
| 117 | 120 |
| 118 #endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ | 121 #endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ |
| OLD | NEW |