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_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ |
6 #define EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ |
7 | 7 |
| 8 #include "ui/gfx/native_widget_types.h" |
| 9 |
8 namespace aura { | 10 namespace aura { |
9 class Window; | 11 class Window; |
10 class WindowTreeHost; | 12 class WindowTreeHost; |
11 } | 13 } |
12 | 14 |
13 namespace content { | 15 namespace content { |
14 class BrowserContext; | 16 class BrowserContext; |
15 } | 17 } |
16 | 18 |
| 19 namespace gfx { |
| 20 class Size; |
| 21 } |
| 22 |
17 namespace extensions { | 23 namespace extensions { |
18 class AppWindow; | 24 class AppWindow; |
19 class Extension; | 25 class Extension; |
20 class ShellAppWindow; | 26 class ShellAppWindow; |
21 | 27 |
22 // DesktopController is an interface to construct the window environment in | 28 // DesktopController is an interface to construct the window environment in |
23 // extensions shell. ShellDesktopController provides a default implementation | 29 // extensions shell. ShellDesktopControllerAura provides a default |
24 // for app_shell, and embedder (such as athena) can provide its own. | 30 // implementation for app_shell, and other embedders (such as athena) can |
| 31 // provide their own. |
25 // TODO(jamescook|oshima): Clean up this interface now that there is only one | 32 // TODO(jamescook|oshima): Clean up this interface now that there is only one |
26 // way to create an app window. | 33 // way to create an app window. |
27 class DesktopController { | 34 class DesktopController { |
28 public: | 35 public: |
29 DesktopController(); | 36 DesktopController(); |
30 virtual ~DesktopController(); | 37 virtual ~DesktopController(); |
31 | 38 |
32 // Returns the single instance of the desktop. (Stateless functions like | 39 // Returns the single instance of the desktop. (Stateless functions like |
33 // ShellAppWindowCreateFunction need to be able to access the desktop, so | 40 // ShellAppWindowCreateFunction need to be able to access the desktop, so |
34 // we need a singleton somewhere). | 41 // we need a singleton somewhere). |
35 static DesktopController* instance(); | 42 static DesktopController* instance(); |
36 | 43 |
37 // Returns the WindowTreeHost created by this DesktopController. | 44 // Get the size of the window created by this DesktopController. This should |
38 virtual aura::WindowTreeHost* GetHost() = 0; | 45 // typically be full-screen. |
| 46 virtual gfx::Size GetWindowSize() = 0; |
39 | 47 |
40 // Creates a new app window and adds it to the desktop. The desktop maintains | 48 // 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 | 49 // ownership of the window. The window must be closed before |extension| is |
42 // destroyed. | 50 // destroyed. |
43 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, | 51 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, |
44 const Extension* extension) = 0; | 52 const Extension* extension) = 0; |
45 | 53 |
46 // Attaches the window to our window hierarchy. | 54 // Attaches the window to our window hierarchy. |
47 virtual void AddAppWindow(aura::Window* window) = 0; | 55 virtual void AddAppWindow(gfx::NativeWindow window) = 0; |
48 | 56 |
49 // Removes the window from the desktop. | 57 // Removes the window from the desktop. |
50 virtual void RemoveAppWindow(AppWindow* window) = 0; | 58 virtual void RemoveAppWindow(AppWindow* window) = 0; |
51 | 59 |
52 // Closes and destroys the app windows. | 60 // Closes and destroys the app windows. |
53 virtual void CloseAppWindows() = 0; | 61 virtual void CloseAppWindows() = 0; |
54 }; | 62 }; |
55 | 63 |
56 } // namespace extensions | 64 } // namespace extensions |
57 | 65 |
58 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ | 66 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ |
OLD | NEW |