| Index: apps/app_window_registry.h
|
| diff --git a/apps/shell_window_registry.h b/apps/app_window_registry.h
|
| similarity index 49%
|
| rename from apps/shell_window_registry.h
|
| rename to apps/app_window_registry.h
|
| index f32b39b4702fae31ba08159d85b6774aa0fb755e..613dac1dd77288d1a02cd624d4622e7d91eb3113 100644
|
| --- a/apps/shell_window_registry.h
|
| +++ b/apps/app_window_registry.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef APPS_SHELL_WINDOW_REGISTRY_H_
|
| -#define APPS_SHELL_WINDOW_REGISTRY_H_
|
| +#ifndef APPS_APP_WINDOW_REGISTRY_H_
|
| +#define APPS_APP_WINDOW_REGISTRY_H_
|
|
|
| #include <list>
|
|
|
| @@ -23,91 +23,91 @@ class RenderViewHost;
|
|
|
| namespace apps {
|
|
|
| -class ShellWindow;
|
| +class AppWindow;
|
|
|
| -// The ShellWindowRegistry tracks the ShellWindows for all platform apps for a
|
| +// The AppWindowRegistry tracks the AppWindows for all platform apps for a
|
| // particular browser context.
|
| -class ShellWindowRegistry : public BrowserContextKeyedService {
|
| +class AppWindowRegistry : public BrowserContextKeyedService {
|
| public:
|
| class Observer {
|
| public:
|
| - // Called just after a shell window was added.
|
| - virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) = 0;
|
| + // Called just after a app window was added.
|
| + virtual void OnAppWindowAdded(apps::AppWindow* app_window) = 0;
|
| // Called when the window icon changes.
|
| - virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window) = 0;
|
| - // Called just after a shell window was removed.
|
| - virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) = 0;
|
| + virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) = 0;
|
| + // Called just after a app window was removed.
|
| + virtual void OnAppWindowRemoved(apps::AppWindow* app_window) = 0;
|
|
|
| protected:
|
| virtual ~Observer() {}
|
| };
|
|
|
| - typedef std::list<apps::ShellWindow*> ShellWindowList;
|
| - typedef ShellWindowList::const_iterator const_iterator;
|
| + typedef std::list<apps::AppWindow*> AppWindowList;
|
| + typedef AppWindowList::const_iterator const_iterator;
|
| typedef std::set<std::string> InspectedWindowSet;
|
|
|
| - explicit ShellWindowRegistry(content::BrowserContext* context);
|
| - virtual ~ShellWindowRegistry();
|
| + explicit AppWindowRegistry(content::BrowserContext* context);
|
| + virtual ~AppWindowRegistry();
|
|
|
| // Returns the instance for the given browser context, or NULL if none. This
|
| // is a convenience wrapper around
|
| - // ShellWindowRegistry::Factory::GetForBrowserContext().
|
| - static ShellWindowRegistry* Get(content::BrowserContext* context);
|
| + // AppWindowRegistry::Factory::GetForBrowserContext().
|
| + static AppWindowRegistry* Get(content::BrowserContext* context);
|
|
|
| - void AddShellWindow(apps::ShellWindow* shell_window);
|
| - void ShellWindowIconChanged(apps::ShellWindow* shell_window);
|
| - // Called by |shell_window| when it is activated.
|
| - void ShellWindowActivated(apps::ShellWindow* shell_window);
|
| - void RemoveShellWindow(apps::ShellWindow* shell_window);
|
| + void AddAppWindow(apps::AppWindow* app_window);
|
| + void AppWindowIconChanged(apps::AppWindow* app_window);
|
| + // Called by |app_window| when it is activated.
|
| + void AppWindowActivated(apps::AppWindow* app_window);
|
| + void RemoveAppWindow(apps::AppWindow* app_window);
|
|
|
| void AddObserver(Observer* observer);
|
| void RemoveObserver(Observer* observer);
|
|
|
| // Returns a set of windows owned by the application identified by app_id.
|
| - ShellWindowList GetShellWindowsForApp(const std::string& app_id) const;
|
| - const ShellWindowList& shell_windows() const { return shell_windows_; }
|
| + AppWindowList GetAppWindowsForApp(const std::string& app_id) const;
|
| + const AppWindowList& app_windows() const { return app_windows_; }
|
|
|
| - // Close all shell windows associated with an app.
|
| - void CloseAllShellWindowsForApp(const std::string& app_id);
|
| + // Close all app windows associated with an app.
|
| + void CloseAllAppWindowsForApp(const std::string& app_id);
|
|
|
| - // Helper functions to find shell windows with particular attributes.
|
| - apps::ShellWindow* GetShellWindowForRenderViewHost(
|
| + // Helper functions to find app windows with particular attributes.
|
| + apps::AppWindow* GetAppWindowForRenderViewHost(
|
| content::RenderViewHost* render_view_host) const;
|
| - apps::ShellWindow* GetShellWindowForNativeWindow(
|
| - gfx::NativeWindow window) const;
|
| - // Returns an app window for the given app, or NULL if no shell windows are
|
| + apps::AppWindow* GetAppWindowForNativeWindow(gfx::NativeWindow window) const;
|
| + // Returns an app window for the given app, or NULL if no app windows are
|
| // open. If there is a window for the given app that is active, that one will
|
| // be returned, otherwise an arbitrary window will be returned.
|
| - apps::ShellWindow* GetCurrentShellWindowForApp(
|
| - const std::string& app_id) const;
|
| - // Returns an app window for the given app and window key, or NULL if no shell
|
| + apps::AppWindow* GetCurrentAppWindowForApp(const std::string& app_id) const;
|
| + // Returns an app window for the given app and window key, or NULL if no app
|
| // window with the key are open. If there is a window for the given app and
|
| // key that is active, that one will be returned, otherwise an arbitrary
|
| // window will be returned.
|
| - apps::ShellWindow* GetShellWindowForAppAndKey(
|
| - const std::string& app_id,
|
| - const std::string& window_key) const;
|
| + apps::AppWindow* GetAppWindowForAppAndKey(const std::string& app_id,
|
| + const std::string& window_key)
|
| + const;
|
|
|
| - // Returns whether a ShellWindow's ID was last known to have a DevToolsAgent
|
| + // Returns whether a AppWindow's ID was last known to have a DevToolsAgent
|
| // attached to it, which should be restored during a reload of a corresponding
|
| // newly created |render_view_host|.
|
| bool HadDevToolsAttached(content::RenderViewHost* render_view_host) const;
|
|
|
| - // Returns the shell window for |window|, looking in all browser contexts.
|
| - static apps::ShellWindow* GetShellWindowForNativeWindowAnyProfile(
|
| + // Returns the app window for |window|, looking in all browser contexts.
|
| + static apps::AppWindow* GetAppWindowForNativeWindowAnyProfile(
|
| gfx::NativeWindow window);
|
|
|
| - // Returns true if the number of shell windows registered across all browser
|
| + // Returns true if the number of app windows registered across all browser
|
| // contexts is non-zero. |window_type_mask| is a bitwise OR filter of
|
| - // ShellWindow::WindowType, or 0 for any window type.
|
| - static bool IsShellWindowRegisteredInAnyProfile(int window_type_mask);
|
| + // AppWindow::WindowType, or 0 for any window type.
|
| + static bool IsAppWindowRegisteredInAnyProfile(int window_type_mask);
|
|
|
| class Factory : public BrowserContextKeyedServiceFactory {
|
| public:
|
| - static ShellWindowRegistry* GetForBrowserContext(
|
| - content::BrowserContext* context, bool create);
|
| + static AppWindowRegistry* GetForBrowserContext(
|
| + content::BrowserContext* context,
|
| + bool create);
|
|
|
| static Factory* GetInstance();
|
| +
|
| private:
|
| friend struct DefaultSingletonTraits<Factory>;
|
|
|
| @@ -127,16 +127,16 @@ class ShellWindowRegistry : public BrowserContextKeyedService {
|
| void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached);
|
|
|
| private:
|
| - // Ensures the specified |shell_window| is included in |shell_windows_|.
|
| - // Otherwise adds |shell_window| to the back of |shell_windows_|.
|
| - void AddShellWindowToList(apps::ShellWindow* shell_window);
|
| + // Ensures the specified |app_window| is included in |app_windows_|.
|
| + // Otherwise adds |app_window| to the back of |app_windows_|.
|
| + void AddAppWindowToList(apps::AppWindow* app_window);
|
|
|
| - // Bring |shell_window| to the front of |shell_windows_|. If it is not in the
|
| + // Bring |app_window| to the front of |app_windows_|. If it is not in the
|
| // list, add it first.
|
| - void BringToFront(apps::ShellWindow* shell_window);
|
| + void BringToFront(apps::AppWindow* app_window);
|
|
|
| content::BrowserContext* context_;
|
| - ShellWindowList shell_windows_;
|
| + AppWindowList app_windows_;
|
| InspectedWindowSet inspected_windows_;
|
| ObserverList<Observer> observers_;
|
| base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
|
| @@ -144,4 +144,4 @@ class ShellWindowRegistry : public BrowserContextKeyedService {
|
|
|
| } // namespace extensions
|
|
|
| -#endif // APPS_SHELL_WINDOW_REGISTRY_H_
|
| +#endif // APPS_APP_WINDOW_REGISTRY_H_
|
|
|