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 namespace aura { | 8 namespace aura { |
9 class Window; | 9 class Window; |
10 class WindowTreeHost; | 10 class WindowTreeHost; |
11 } | 11 } |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
| 18 class AppWindow; |
18 class Extension; | 19 class Extension; |
19 class ShellAppWindow; | 20 class ShellAppWindow; |
20 | 21 |
21 // DesktopController is an interface to construct the window environment in | 22 // DesktopController is an interface to construct the window environment in |
22 // extensions shell. ShellDesktopController provides a default implementation | 23 // extensions shell. ShellDesktopController provides a default implementation |
23 // for | 24 // for |
24 // app_shell, and embedder (such as athena) can provide its own. | 25 // app_shell, and embedder (such as athena) can provide its own. |
25 class DesktopController { | 26 class DesktopController { |
26 public: | 27 public: |
27 DesktopController(); | 28 DesktopController(); |
28 virtual ~DesktopController(); | 29 virtual ~DesktopController(); |
29 | 30 |
30 // Returns the single instance of the desktop. (Stateless functions like | 31 // Returns the single instance of the desktop. (Stateless functions like |
31 // ShellAppWindowCreateFunction need to be able to access the desktop, so | 32 // ShellAppWindowCreateFunction need to be able to access the desktop, so |
32 // we need a singleton somewhere). | 33 // we need a singleton somewhere). |
33 static DesktopController* instance(); | 34 static DesktopController* instance(); |
34 | 35 |
35 // Returns the WindowTreeHost created by this DesktopController. | 36 // Returns the WindowTreeHost created by this DesktopController. |
36 virtual aura::WindowTreeHost* GetHost() = 0; | 37 virtual aura::WindowTreeHost* GetHost() = 0; |
37 | 38 |
| 39 // Creates a new ShellAppWindow and adds it to the desktop. The desktop |
| 40 // maintains ownership of the window. The window must be closed before |
| 41 // |extension| is destroyed. |
| 42 virtual ShellAppWindow* CreateShellAppWindow(content::BrowserContext* context, |
| 43 const Extension* extension) = 0; |
| 44 |
38 // Creates a new app window and adds it to the desktop. The desktop maintains | 45 // Creates a new app window and adds it to the desktop. The desktop maintains |
39 // ownership of the window. The window must be closed before |extension| is | 46 // ownership of the window. The window must be closed before |extension| is |
40 // destroyed. | 47 // destroyed. |
41 virtual ShellAppWindow* CreateAppWindow(content::BrowserContext* context, | 48 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, |
42 const Extension* extension) = 0; | 49 const Extension* extension) = 0; |
43 | 50 |
44 // Attaches the window to our window hierarchy. | 51 // Attaches the window to our window hierarchy. |
45 virtual void AddAppWindow(aura::Window* window) = 0; | 52 virtual void AddAppWindow(aura::Window* window) = 0; |
46 | 53 |
47 // Closes and destroys the app windows. | 54 // Closes and destroys the app windows. |
48 virtual void CloseAppWindows() = 0; | 55 virtual void CloseAppWindows() = 0; |
49 }; | 56 }; |
50 | 57 |
51 } // namespace extensinos | 58 } // namespace extensinos |
52 | 59 |
53 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ | 60 #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_ |
OLD | NEW |