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 { |
(...skipping 18 matching lines...) Expand all Loading... |
45 } | 46 } |
46 | 47 |
47 namespace wm { | 48 namespace wm { |
48 class CompoundEventFilter; | 49 class CompoundEventFilter; |
49 class CursorManager; | 50 class CursorManager; |
50 } | 51 } |
51 | 52 |
52 namespace extensions { | 53 namespace extensions { |
53 class AppWindowClient; | 54 class AppWindowClient; |
54 class Extension; | 55 class Extension; |
| 56 class InputMethodEventHandler; |
55 class ShellScreen; | 57 class ShellScreen; |
56 | 58 |
57 // Handles desktop-related tasks for app_shell. | 59 // Simple desktop controller for app_shell. Sets up a root Aura window for the |
| 60 // primary display. |
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: |
| 110 FRIEND_TEST_ALL_PREFIXES(ShellDesktopControllerAuraTest, InputEvents); |
| 111 |
102 // Creates the window that hosts the app. | 112 // Creates the window that hosts the app. |
103 void CreateRootWindow(); | 113 void CreateRootWindow(); |
104 | 114 |
105 // Closes and destroys the root window hosting the app. | 115 // Closes and destroys the root window hosting the app. |
106 void DestroyRootWindow(); | 116 void DestroyRootWindow(); |
107 | 117 |
108 // Returns the dimensions (in pixels) of the primary display, or an empty size | 118 // 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. | 119 // if the dimensions can't be determined or no display is connected. |
110 gfx::Size GetPrimaryDisplaySize(); | 120 gfx::Size GetPrimaryDisplaySize(); |
111 | 121 |
112 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
113 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; | 123 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; |
114 #endif | 124 #endif |
115 | 125 |
116 std::unique_ptr<ShellScreen> screen_; | 126 std::unique_ptr<ShellScreen> screen_; |
117 | 127 |
118 std::unique_ptr<aura::WindowTreeHost> host_; | 128 std::unique_ptr<aura::WindowTreeHost> host_; |
119 | 129 |
120 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; | 130 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; |
121 | 131 |
| 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 |