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_
8 #include "ui/gfx/native_widget_types.h"
23 namespace extensions
{
28 // DesktopController is an interface to construct the window environment in
29 // extensions shell. ShellDesktopControllerAura provides a default
30 // implementation for app_shell, and other embedders can provide their own.
31 // TODO(jamescook|oshima): Clean up this interface now that there is only one
32 // way to create an app window.
33 class DesktopController
{
36 virtual ~DesktopController();
38 // Returns the single instance of the desktop. (Stateless functions like
39 // ShellAppWindowCreateFunction need to be able to access the desktop, so
40 // we need a singleton somewhere).
41 static DesktopController
* instance();
43 // Get the size of the window created by this DesktopController. This should
44 // typically be full-screen.
45 virtual gfx::Size
GetWindowSize() = 0;
47 // Creates a new app window and adds it to the desktop. The desktop maintains
48 // ownership of the window. The window must be closed before |extension| is
50 virtual AppWindow
* CreateAppWindow(content::BrowserContext
* context
,
51 const Extension
* extension
) = 0;
53 // Attaches the window to our window hierarchy.
54 virtual void AddAppWindow(gfx::NativeWindow window
) = 0;
56 // Removes the window from the desktop.
57 virtual void RemoveAppWindow(AppWindow
* window
) = 0;
59 // Closes and destroys the app windows.
60 virtual void CloseAppWindows() = 0;
63 } // namespace extensions
65 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_