Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: extensions/shell/browser/shell_desktop_controller.h

Issue 480353006: Separate athena's startup process from AppShell's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_SHELL_DESKTOP_CONTROLLER_H_ 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/shell/browser/desktop_controller.h"
11 #include "ui/aura/client/window_tree_client.h" 12 #include "ui/aura/client/window_tree_client.h"
12 #include "ui/aura/window_tree_host_observer.h" 13 #include "ui/aura/window_tree_host_observer.h"
13 14
14 #if defined(OS_CHROMEOS) 15 #if defined(OS_CHROMEOS)
15 #include "chromeos/dbus/power_manager_client.h" 16 #include "chromeos/dbus/power_manager_client.h"
16 #include "ui/display/chromeos/display_configurator.h" 17 #include "ui/display/chromeos/display_configurator.h"
17 #endif 18 #endif
18 19
19 namespace aura { 20 namespace aura {
20 class TestScreen; 21 class TestScreen;
21 class Window; 22 class Window;
22 class WindowTreeHost; 23 class WindowTreeHost;
23 namespace client { 24 namespace client {
24 class DefaultCaptureClient; 25 class DefaultCaptureClient;
25 class FocusClient; 26 class FocusClient;
26 } 27 }
27 } 28 }
28 29
29 namespace content { 30 namespace content {
30 class BrowserContext; 31 class BrowserContext;
31 } 32 }
32 33
33 namespace gfx { 34 namespace gfx {
34 class Insets;
35 class Size; 35 class Size;
36 } 36 }
37 37
38 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
39 namespace ui { 39 namespace ui {
40 class UserActivityPowerManagerNotifier; 40 class UserActivityPowerManagerNotifier;
41 } 41 }
42 #endif 42 #endif
43 43
44 namespace wm { 44 namespace wm {
45 class CompoundEventFilter; 45 class CompoundEventFilter;
46 class CursorManager; 46 class CursorManager;
47 class FocusRules;
48 class InputMethodEventFilter; 47 class InputMethodEventFilter;
49 class UserActivityDetector; 48 class UserActivityDetector;
50 } 49 }
51 50
52 namespace extensions { 51 namespace extensions {
53 52
54 class Extension; 53 class Extension;
55 class ShellAppWindow; 54 class ShellAppWindow;
56 class ShellAppWindowController; 55 class ShellAppWindowController;
57 56
58 // Handles desktop-related tasks for app_shell. 57 // Handles desktop-related tasks for app_shell.
59 class ShellDesktopController : public aura::client::WindowTreeClient, 58 class ShellDesktopController : public DesktopController,
59 public aura::client::WindowTreeClient,
60 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
61 public chromeos::PowerManagerClient::Observer, 61 public chromeos::PowerManagerClient::Observer,
62 public ui::DisplayConfigurator::Observer, 62 public ui::DisplayConfigurator::Observer,
63 #endif 63 #endif
64 public aura::WindowTreeHostObserver { 64 public aura::WindowTreeHostObserver {
65 public: 65 public:
66 ShellDesktopController(); 66 ShellDesktopController();
67 virtual ~ShellDesktopController(); 67 virtual ~ShellDesktopController();
68 68
69 // Returns the single instance of the desktop. (Stateless functions like 69 // DesktopController:
70 // ShellAppWindowCreateFunction need to be able to access the desktop, so 70 virtual aura::WindowTreeHost* GetHost() OVERRIDE;
71 // we need a singleton somewhere). 71 virtual ShellAppWindow* CreateAppWindow(content::BrowserContext* context,
72 static ShellDesktopController* instance(); 72 const Extension* extension) OVERRIDE;
73 73 virtual void CloseAppWindows() OVERRIDE;
74 aura::WindowTreeHost* host() { return host_.get(); }
75
76 // Sets the controller to create/close the app windows. Takes the ownership of
77 // |app_window_controller|.
78 void SetAppWindowController(ShellAppWindowController* app_window_controller);
79
80 // Creates a new app window and adds it to the desktop. The desktop maintains
81 // ownership of the window. The window must be closed before |extension| is
82 // destroyed.
83 ShellAppWindow* CreateAppWindow(content::BrowserContext* context,
84 const Extension* extension);
85
86 // Closes and destroys the app windows.
87 void CloseAppWindows();
88
89 // Sets the screen's work area insets.
90 void SetDisplayWorkAreaInsets(const gfx::Insets& insets);
91 74
92 // aura::client::WindowTreeClient overrides: 75 // aura::client::WindowTreeClient overrides:
93 virtual aura::Window* GetDefaultParent(aura::Window* context, 76 virtual aura::Window* GetDefaultParent(aura::Window* context,
94 aura::Window* window, 77 aura::Window* window,
95 const gfx::Rect& bounds) OVERRIDE; 78 const gfx::Rect& bounds) OVERRIDE;
96 79
97 #if defined(OS_CHROMEOS) 80 #if defined(OS_CHROMEOS)
98 // chromeos::PowerManagerClient::Observer overrides: 81 // chromeos::PowerManagerClient::Observer overrides:
99 virtual void PowerButtonEventReceived(bool down, 82 virtual void PowerButtonEventReceived(bool down,
100 const base::TimeTicks& timestamp) 83 const base::TimeTicks& timestamp)
101 OVERRIDE; 84 OVERRIDE;
102 85
103 // ui::DisplayConfigurator::Observer overrides. 86 // ui::DisplayConfigurator::Observer overrides.
104 virtual void OnDisplayModeChanged(const std::vector< 87 virtual void OnDisplayModeChanged(const std::vector<
105 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; 88 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE;
106 #endif 89 #endif
107 90
108 // aura::WindowTreeHostObserver overrides: 91 // aura::WindowTreeHostObserver overrides:
109 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE; 92 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
110 93
111 protected: 94 protected:
112 // Creates and sets the aura clients and window manager stuff. Subclass may 95 // Creates and sets the aura clients and window manager stuff. Subclass may
113 // initialize different sets of the clients. 96 // initialize different sets of the clients.
114 virtual void InitWindowManager(); 97 virtual void InitWindowManager();
115 98
116 // Creates a focus rule that is to be used in the InitWindowManager.
117 virtual wm::FocusRules* CreateFocusRules();
118
119 private: 99 private:
120 // Creates the window that hosts the app. 100 // Creates the window that hosts the app.
121 void CreateRootWindow(); 101 void CreateRootWindow();
122 102
123 // Closes and destroys the root window hosting the app. 103 // Closes and destroys the root window hosting the app.
124 void DestroyRootWindow(); 104 void DestroyRootWindow();
125 105
126 // Returns the dimensions (in pixels) of the primary display, or an empty size 106 // Returns the dimensions (in pixels) of the primary display, or an empty size
127 // if the dimensions can't be determined or no display is connected. 107 // if the dimensions can't be determined or no display is connected.
128 gfx::Size GetPrimaryDisplaySize(); 108 gfx::Size GetPrimaryDisplaySize();
(...skipping 15 matching lines...) Expand all
144 scoped_ptr<aura::client::FocusClient> focus_client_; 124 scoped_ptr<aura::client::FocusClient> focus_client_;
145 125
146 scoped_ptr<wm::CursorManager> cursor_manager_; 126 scoped_ptr<wm::CursorManager> cursor_manager_;
147 127
148 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; 128 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
149 #if defined(OS_CHROMEOS) 129 #if defined(OS_CHROMEOS)
150 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; 130 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
151 #endif 131 #endif
152 132
153 // The desktop supports a single app window. 133 // The desktop supports a single app window.
154 scoped_ptr<ShellAppWindowController> app_window_controller_; 134 scoped_ptr<ShellAppWindow> app_window_;
155 135
156 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); 136 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
157 }; 137 };
158 138
159 } // namespace extensions 139 } // namespace extensions
160 140
161 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ 141 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698