Chromium Code Reviews| 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 APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 5 #ifndef APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
| 6 #define APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 6 #define APPS_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 "ui/aura/client/window_tree_client.h" | |
| 11 #include "ui/aura/window_tree_host_observer.h" | 12 #include "ui/aura/window_tree_host_observer.h" |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "ui/display/chromeos/display_configurator.h" | 15 #include "ui/display/chromeos/display_configurator.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 class TestScreen; | 19 class TestScreen; |
| 20 class Window; | |
| 20 class WindowTreeHost; | 21 class WindowTreeHost; |
| 22 namespace client { | |
| 23 class DefaultCaptureClient; | |
| 24 class FocusClient; | |
| 25 } | |
| 21 } | 26 } |
| 22 | 27 |
| 23 namespace content { | 28 namespace content { |
| 24 class BrowserContext; | 29 class BrowserContext; |
| 25 } | 30 } |
| 26 | 31 |
| 32 namespace gfx { | |
| 33 class Size; | |
| 34 } | |
| 35 | |
| 27 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 28 namespace ui { | 37 namespace ui { |
| 29 class UserActivityPowerManagerNotifier; | 38 class UserActivityPowerManagerNotifier; |
| 30 } | 39 } |
| 31 #endif | 40 #endif |
| 32 | 41 |
| 33 namespace wm { | 42 namespace wm { |
| 43 class CompoundEventFilter; | |
| 34 class CursorManager; | 44 class CursorManager; |
| 45 class InputMethodEventFilter; | |
| 35 class UserActivityDetector; | 46 class UserActivityDetector; |
| 36 class WMTestHelper; | |
| 37 } | 47 } |
| 38 | 48 |
| 39 namespace apps { | 49 namespace apps { |
| 40 | 50 |
| 41 class ShellAppWindow; | 51 class ShellAppWindow; |
| 42 | 52 |
| 43 // Handles desktop-related tasks for app_shell. | 53 // Handles desktop-related tasks for app_shell. |
| 44 class ShellDesktopController | 54 class ShellDesktopController : public aura::client::WindowTreeClient, |
| 55 public aura::WindowTreeHostObserver | |
| 45 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 46 : public ui::DisplayConfigurator::Observer | 57 , |
| 58 public ui::DisplayConfigurator::Observer | |
| 47 #endif | 59 #endif |
| 48 { | 60 { |
| 49 public: | 61 public: |
| 50 ShellDesktopController(); | 62 ShellDesktopController(); |
| 51 virtual ~ShellDesktopController(); | 63 virtual ~ShellDesktopController(); |
| 52 | 64 |
| 53 // Returns the single instance of the desktop. (Stateless functions like | 65 // Returns the single instance of the desktop. (Stateless functions like |
| 54 // ShellAppWindowCreateFunction need to be able to access the desktop, so | 66 // ShellAppWindowCreateFunction need to be able to access the desktop, so |
| 55 // we need a singleton somewhere). | 67 // we need a singleton somewhere). |
| 56 static ShellDesktopController* instance(); | 68 static ShellDesktopController* instance(); |
| 57 | 69 |
| 70 aura::WindowTreeHost* host() { | |
| 71 return host_.get(); | |
| 72 }; | |
|
tfarina
2014/05/30 20:05:51
ouch. no, no need of ; here. No presubmit lint cau
Jun Mukai
2014/05/30 20:13:32
Done.
| |
| 73 | |
| 74 // Creates the window that hosts the app. | |
| 75 void CreateRootWindow(); | |
| 76 | |
| 58 // Creates a new app window and adds it to the desktop. The desktop maintains | 77 // Creates a new app window and adds it to the desktop. The desktop maintains |
| 59 // ownership of the window. | 78 // ownership of the window. |
| 60 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); | 79 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); |
| 61 | 80 |
| 62 // Closes and destroys the app window. | 81 // Closes and destroys the app window. |
| 63 void CloseAppWindow(); | 82 void CloseAppWindow(); |
| 64 | 83 |
| 65 // Returns the host for the Aura window tree. | 84 // Overridden from aura::client::WindowTreeClient: |
| 66 aura::WindowTreeHost* GetWindowTreeHost(); | 85 virtual aura::Window* GetDefaultParent(aura::Window* context, |
| 86 aura::Window* window, | |
| 87 const gfx::Rect& bounds) OVERRIDE; | |
| 67 | 88 |
| 68 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
| 69 // ui::DisplayConfigurator::Observer overrides. | 90 // ui::DisplayConfigurator::Observer overrides. |
| 70 virtual void OnDisplayModeChanged(const std::vector< | 91 virtual void OnDisplayModeChanged(const std::vector< |
| 71 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; | 92 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; |
| 72 #endif | 93 #endif |
| 73 | 94 |
| 95 // aura::WindowTreeHostObserver overrides: | |
| 96 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE; | |
| 97 | |
| 98 protected: | |
| 99 // Creates and sets the aura clients and window manager stuff. Subclass may | |
| 100 // initialize different sets of the clients. | |
| 101 virtual void InitWindowManager(); | |
| 102 | |
| 74 private: | 103 private: |
| 75 // Creates the window that hosts the app. | |
| 76 void CreateRootWindow(); | |
| 77 | |
| 78 // Closes and destroys the root window hosting the app. | 104 // Closes and destroys the root window hosting the app. |
| 79 void DestroyRootWindow(); | 105 void DestroyRootWindow(); |
| 80 | 106 |
| 81 // Returns the dimensions (in pixels) of the primary display, or an empty size | 107 // Returns the dimensions (in pixels) of the primary display, or an empty size |
| 82 // if the dimensions can't be determined or no display is connected. | 108 // if the dimensions can't be determined or no display is connected. |
| 83 gfx::Size GetPrimaryDisplaySize(); | 109 gfx::Size GetPrimaryDisplaySize(); |
| 84 | 110 |
| 85 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
| 86 scoped_ptr<ui::DisplayConfigurator> display_configurator_; | 112 scoped_ptr<ui::DisplayConfigurator> display_configurator_; |
| 87 #endif | 113 #endif |
| 88 | 114 |
| 89 // Enable a minimal set of views::corewm to be initialized. | 115 scoped_ptr<aura::TestScreen> test_screen_; |
| 90 scoped_ptr<wm::WMTestHelper> wm_test_helper_; | |
| 91 | 116 |
| 92 scoped_ptr<aura::TestScreen> test_screen_; | 117 scoped_ptr<aura::WindowTreeHost> host_; |
| 118 | |
| 119 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_; | |
| 120 | |
| 121 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | |
| 122 | |
| 123 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_; | |
| 124 | |
| 125 scoped_ptr<aura::client::FocusClient> focus_client_; | |
| 93 | 126 |
| 94 scoped_ptr<wm::CursorManager> cursor_manager_; | 127 scoped_ptr<wm::CursorManager> cursor_manager_; |
| 95 | 128 |
| 96 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; | 129 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; |
| 97 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
| 98 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; | 131 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; |
| 99 #endif | 132 #endif |
| 100 | 133 |
| 101 // The desktop supports a single app window. | 134 // The desktop supports a single app window. |
| 102 scoped_ptr<ShellAppWindow> app_window_; | 135 scoped_ptr<ShellAppWindow> app_window_; |
| 103 | 136 |
| 104 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); | 137 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); |
| 105 }; | 138 }; |
| 106 | 139 |
| 107 } // namespace apps | 140 } // namespace apps |
| 108 | 141 |
| 109 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 142 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
| OLD | NEW |