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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_
6 #define EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_
17 namespace extensions {
22 // DesktopController is an interface to construct the window environment in
23 // extensions shell. ShellDesktopController provides a default implementation
24 // for app_shell, and embedder (such as athena) can provide its own.
25 // TODO(jamescook|oshima): Clean up this interface now that there is only one
26 // way to create an app window.
27 class DesktopController {
30 virtual ~DesktopController();
32 // Returns the single instance of the desktop. (Stateless functions like
33 // ShellAppWindowCreateFunction need to be able to access the desktop, so
34 // we need a singleton somewhere).
35 static DesktopController* instance();
37 // Returns the WindowTreeHost created by this DesktopController.
38 virtual aura::WindowTreeHost* GetHost() = 0;
40 // Creates a new app window and adds it to the desktop. The desktop maintains
41 // ownership of the window. The window must be closed before |extension| is
43 virtual AppWindow* CreateAppWindow(content::BrowserContext* context,
44 const Extension* extension) = 0;
46 // Attaches the window to our window hierarchy.
47 virtual void AddAppWindow(aura::Window* window) = 0;
49 // Removes the window from the desktop.
50 virtual void RemoveAppWindow(AppWindow* window) = 0;
52 // Closes and destroys the app windows.
53 virtual void CloseAppWindows() = 0;
56 } // namespace extensions
58 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_