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 EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "extensions/shell/browser/desktop_controller.h" | 14 #include "extensions/shell/browser/desktop_controller.h" |
| 15 #include "ui/aura/client/window_parenting_client.h" | 15 #include "ui/aura/client/window_parenting_client.h" |
| 16 #include "ui/aura/window_tree_host_observer.h" | 16 #include "ui/aura/window_tree_host_observer.h" |
| 17 #include "ui/base/ime/input_method_delegate.h" | |
| 17 | 18 |
| 18 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 19 #include "chromeos/dbus/power_manager_client.h" | 20 #include "chromeos/dbus/power_manager_client.h" |
| 20 #include "ui/display/manager/chromeos/display_configurator.h" | 21 #include "ui/display/manager/chromeos/display_configurator.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace aura { | 24 namespace aura { |
| 24 class Window; | 25 class Window; |
| 25 class WindowTreeHost; | 26 class WindowTreeHost; |
| 26 namespace client { | 27 namespace client { |
| 27 class DefaultCaptureClient; | 28 class DefaultCaptureClient; |
| 28 class FocusClient; | 29 class FocusClient; |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace content { | 33 namespace content { |
| 33 class BrowserContext; | 34 class BrowserContext; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace gfx { | 37 namespace gfx { |
| 37 class Size; | 38 class Size; |
| 38 } | 39 } |
| 39 | 40 |
| 40 namespace ui { | 41 namespace ui { |
| 42 class InputMethod; | |
| 41 class UserActivityDetector; | 43 class UserActivityDetector; |
| 42 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 43 class UserActivityPowerManagerNotifier; | 45 class UserActivityPowerManagerNotifier; |
| 44 #endif | 46 #endif |
| 45 } | 47 } |
| 46 | 48 |
| 47 namespace wm { | 49 namespace wm { |
| 48 class CompoundEventFilter; | 50 class CompoundEventFilter; |
| 49 class CursorManager; | 51 class CursorManager; |
| 50 } | 52 } |
| 51 | 53 |
| 52 namespace extensions { | 54 namespace extensions { |
| 53 class AppWindowClient; | 55 class AppWindowClient; |
| 54 class Extension; | 56 class Extension; |
| 57 class InputMethodEventHandler; | |
| 55 class ShellScreen; | 58 class ShellScreen; |
| 56 | 59 |
| 57 // Handles desktop-related tasks for app_shell. | 60 // Handles desktop-related tasks for app_shell. |
| 58 class ShellDesktopControllerAura | 61 class ShellDesktopControllerAura |
| 59 : public DesktopController, | 62 : public DesktopController, |
| 60 public aura::client::WindowParentingClient, | 63 public aura::client::WindowParentingClient, |
| 61 #if defined(OS_CHROMEOS) | 64 #if defined(OS_CHROMEOS) |
| 62 public chromeos::PowerManagerClient::Observer, | 65 public chromeos::PowerManagerClient::Observer, |
| 63 public ui::DisplayConfigurator::Observer, | 66 public ui::DisplayConfigurator::Observer, |
| 64 #endif | 67 #endif |
| 65 public aura::WindowTreeHostObserver { | 68 public aura::WindowTreeHostObserver, |
| 69 public ui::internal::InputMethodDelegate { | |
| 66 public: | 70 public: |
| 67 ShellDesktopControllerAura(); | 71 ShellDesktopControllerAura(); |
| 68 ~ShellDesktopControllerAura() override; | 72 ~ShellDesktopControllerAura() override; |
| 69 | 73 |
| 70 // DesktopController: | 74 // DesktopController: |
| 71 gfx::Size GetWindowSize() override; | 75 gfx::Size GetWindowSize() override; |
| 72 AppWindow* CreateAppWindow(content::BrowserContext* context, | 76 AppWindow* CreateAppWindow(content::BrowserContext* context, |
| 73 const Extension* extension) override; | 77 const Extension* extension) override; |
| 74 void AddAppWindow(gfx::NativeWindow window) override; | 78 void AddAppWindow(gfx::NativeWindow window) override; |
| 75 void RemoveAppWindow(AppWindow* window) override; | 79 void RemoveAppWindow(AppWindow* window) override; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 86 const base::TimeTicks& timestamp) override; | 90 const base::TimeTicks& timestamp) override; |
| 87 | 91 |
| 88 // ui::DisplayConfigurator::Observer overrides. | 92 // ui::DisplayConfigurator::Observer overrides. |
| 89 void OnDisplayModeChanged( | 93 void OnDisplayModeChanged( |
| 90 const ui::DisplayConfigurator::DisplayStateList& displays) override; | 94 const ui::DisplayConfigurator::DisplayStateList& displays) override; |
| 91 #endif | 95 #endif |
| 92 | 96 |
| 93 // aura::WindowTreeHostObserver overrides: | 97 // aura::WindowTreeHostObserver overrides: |
| 94 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; | 98 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; |
| 95 | 99 |
| 100 // ui::internal::InputMethodDelegate overrides: | |
| 101 ui::EventDispatchDetails DispatchKeyEventPostIME( | |
| 102 ui::KeyEvent* key_event) override; | |
| 103 | |
| 96 protected: | 104 protected: |
| 97 // Creates and sets the aura clients and window manager stuff. Subclass may | 105 // Creates and sets the aura clients and window manager stuff. Subclass may |
| 98 // initialize different sets of the clients. | 106 // initialize different sets of the clients. |
| 99 virtual void InitWindowManager(); | 107 virtual void InitWindowManager(); |
| 100 | 108 |
| 101 private: | 109 private: |
| 102 // Creates the window that hosts the app. | 110 // Creates the window that hosts the app. |
| 103 void CreateRootWindow(); | 111 void CreateRootWindow(); |
| 104 | 112 |
| 105 // Closes and destroys the root window hosting the app. | 113 // Closes and destroys the root window hosting the app. |
| 106 void DestroyRootWindow(); | 114 void DestroyRootWindow(); |
| 107 | 115 |
| 108 // Returns the dimensions (in pixels) of the primary display, or an empty size | 116 // Returns the dimensions (in pixels) of the primary display, or an empty size |
| 109 // if the dimensions can't be determined or no display is connected. | 117 // if the dimensions can't be determined or no display is connected. |
| 110 gfx::Size GetPrimaryDisplaySize(); | 118 gfx::Size GetPrimaryDisplaySize(); |
| 111 | 119 |
| 112 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
| 113 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; | 121 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; |
| 114 #endif | 122 #endif |
| 115 | 123 |
| 116 std::unique_ptr<ShellScreen> screen_; | 124 std::unique_ptr<ShellScreen> screen_; |
| 117 | 125 |
| 118 std::unique_ptr<aura::WindowTreeHost> host_; | 126 std::unique_ptr<aura::WindowTreeHost> host_; |
| 119 | 127 |
| 120 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; | 128 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; |
| 121 | 129 |
|
Rahul Chaturvedi
2016/12/15 22:42:46
nit: Add a comment here that input_method_ needs t
michaelpg
2016/12/15 23:55:52
Removed input_method_.
| |
| 130 std::unique_ptr<ui::InputMethod> input_method_; | |
| 131 | |
|
Rahul Chaturvedi
2016/12/15 22:42:46
nit: remove line, so these two are grouped togethe
michaelpg
2016/12/15 23:55:52
Acknowledged.
| |
| 132 std::unique_ptr<InputMethodEventHandler> input_method_event_handler_; | |
| 133 | |
| 122 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 134 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 123 | 135 |
| 124 std::unique_ptr<aura::client::FocusClient> focus_client_; | 136 std::unique_ptr<aura::client::FocusClient> focus_client_; |
| 125 | 137 |
| 126 std::unique_ptr<wm::CursorManager> cursor_manager_; | 138 std::unique_ptr<wm::CursorManager> cursor_manager_; |
| 127 | 139 |
| 128 std::unique_ptr<ui::UserActivityDetector> user_activity_detector_; | 140 std::unique_ptr<ui::UserActivityDetector> user_activity_detector_; |
| 129 #if defined(OS_CHROMEOS) | 141 #if defined(OS_CHROMEOS) |
| 130 std::unique_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; | 142 std::unique_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; |
| 131 #endif | 143 #endif |
| 132 | 144 |
| 133 std::unique_ptr<AppWindowClient> app_window_client_; | 145 std::unique_ptr<AppWindowClient> app_window_client_; |
| 134 | 146 |
| 135 // NativeAppWindow::Close() deletes the AppWindow. | 147 // NativeAppWindow::Close() deletes the AppWindow. |
| 136 std::vector<AppWindow*> app_windows_; | 148 std::vector<AppWindow*> app_windows_; |
| 137 | 149 |
| 138 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); | 150 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); |
| 139 }; | 151 }; |
| 140 | 152 |
| 141 } // namespace extensions | 153 } // namespace extensions |
| 142 | 154 |
| 143 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ | 155 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ |
| OLD | NEW |