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 // Handles desktop-related tasks for app_shell. |
58 class ShellDesktopControllerAura | 60 class ShellDesktopControllerAura |
59 : public DesktopController, | 61 : public DesktopController, |
60 public aura::client::WindowParentingClient, | 62 public aura::client::WindowParentingClient, |
61 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
62 public chromeos::PowerManagerClient::Observer, | 64 public chromeos::PowerManagerClient::Observer, |
63 public ui::DisplayConfigurator::Observer, | 65 public ui::DisplayConfigurator::Observer, |
64 #endif | 66 #endif |
65 public aura::WindowTreeHostObserver { | 67 public aura::WindowTreeHostObserver, |
| 68 public ui::internal::InputMethodDelegate { |
66 public: | 69 public: |
67 ShellDesktopControllerAura(); | 70 ShellDesktopControllerAura(); |
68 ~ShellDesktopControllerAura() override; | 71 ~ShellDesktopControllerAura() override; |
69 | 72 |
70 // DesktopController: | 73 // DesktopController: |
71 gfx::Size GetWindowSize() override; | 74 gfx::Size GetWindowSize() override; |
72 AppWindow* CreateAppWindow(content::BrowserContext* context, | 75 AppWindow* CreateAppWindow(content::BrowserContext* context, |
73 const Extension* extension) override; | 76 const Extension* extension) override; |
74 void AddAppWindow(gfx::NativeWindow window) override; | 77 void AddAppWindow(gfx::NativeWindow window) override; |
75 void RemoveAppWindow(AppWindow* window) override; | 78 void RemoveAppWindow(AppWindow* window) override; |
(...skipping 10 matching lines...) Expand all Loading... |
86 const base::TimeTicks& timestamp) override; | 89 const base::TimeTicks& timestamp) override; |
87 | 90 |
88 // ui::DisplayConfigurator::Observer overrides. | 91 // ui::DisplayConfigurator::Observer overrides. |
89 void OnDisplayModeChanged( | 92 void OnDisplayModeChanged( |
90 const ui::DisplayConfigurator::DisplayStateList& displays) override; | 93 const ui::DisplayConfigurator::DisplayStateList& displays) override; |
91 #endif | 94 #endif |
92 | 95 |
93 // aura::WindowTreeHostObserver overrides: | 96 // aura::WindowTreeHostObserver overrides: |
94 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; | 97 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; |
95 | 98 |
| 99 // ui::internal::InputMethodDelegate overrides: |
| 100 ui::EventDispatchDetails DispatchKeyEventPostIME( |
| 101 ui::KeyEvent* key_event) override; |
| 102 |
96 protected: | 103 protected: |
97 // Creates and sets the aura clients and window manager stuff. Subclass may | 104 // Creates and sets the aura clients and window manager stuff. Subclass may |
98 // initialize different sets of the clients. | 105 // initialize different sets of the clients. |
99 virtual void InitWindowManager(); | 106 virtual void InitWindowManager(); |
100 | 107 |
101 private: | 108 private: |
102 // Creates the window that hosts the app. | 109 // Creates the window that hosts the app. |
103 void CreateRootWindow(); | 110 void CreateRootWindow(); |
104 | 111 |
105 // Closes and destroys the root window hosting the app. | 112 // Closes and destroys the root window hosting the app. |
106 void DestroyRootWindow(); | 113 void DestroyRootWindow(); |
107 | 114 |
108 // Returns the dimensions (in pixels) of the primary display, or an empty size | 115 // 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. | 116 // if the dimensions can't be determined or no display is connected. |
110 gfx::Size GetPrimaryDisplaySize(); | 117 gfx::Size GetPrimaryDisplaySize(); |
111 | 118 |
112 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
113 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; | 120 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; |
114 #endif | 121 #endif |
115 | 122 |
116 std::unique_ptr<ShellScreen> screen_; | 123 std::unique_ptr<ShellScreen> screen_; |
117 | 124 |
118 std::unique_ptr<aura::WindowTreeHost> host_; | 125 std::unique_ptr<aura::WindowTreeHost> host_; |
119 | 126 |
120 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; | 127 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; |
121 | 128 |
| 129 std::unique_ptr<InputMethodEventHandler> input_method_event_handler_; |
| 130 |
122 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 131 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
123 | 132 |
124 std::unique_ptr<aura::client::FocusClient> focus_client_; | 133 std::unique_ptr<aura::client::FocusClient> focus_client_; |
125 | 134 |
126 std::unique_ptr<wm::CursorManager> cursor_manager_; | 135 std::unique_ptr<wm::CursorManager> cursor_manager_; |
127 | 136 |
128 std::unique_ptr<ui::UserActivityDetector> user_activity_detector_; | 137 std::unique_ptr<ui::UserActivityDetector> user_activity_detector_; |
129 #if defined(OS_CHROMEOS) | 138 #if defined(OS_CHROMEOS) |
130 std::unique_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; | 139 std::unique_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; |
131 #endif | 140 #endif |
132 | 141 |
133 std::unique_ptr<AppWindowClient> app_window_client_; | 142 std::unique_ptr<AppWindowClient> app_window_client_; |
134 | 143 |
135 // NativeAppWindow::Close() deletes the AppWindow. | 144 // NativeAppWindow::Close() deletes the AppWindow. |
136 std::vector<AppWindow*> app_windows_; | 145 std::vector<AppWindow*> app_windows_; |
137 | 146 |
138 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); | 147 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); |
139 }; | 148 }; |
140 | 149 |
141 } // namespace extensions | 150 } // namespace extensions |
142 | 151 |
143 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ | 152 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ |
OLD | NEW |