| 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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class InputMethodEventHandler; | 56 class InputMethodEventHandler; |
| 57 class ShellScreen; | 57 class ShellScreen; |
| 58 | 58 |
| 59 // Simple desktop controller for app_shell. Sets up a root Aura window for the | 59 // Simple desktop controller for app_shell. Sets up a root Aura window for the |
| 60 // primary display. | 60 // primary display. |
| 61 class ShellDesktopControllerAura | 61 class ShellDesktopControllerAura |
| 62 : public DesktopController, | 62 : public DesktopController, |
| 63 public aura::client::WindowParentingClient, | 63 public aura::client::WindowParentingClient, |
| 64 #if defined(OS_CHROMEOS) | 64 #if defined(OS_CHROMEOS) |
| 65 public chromeos::PowerManagerClient::Observer, | 65 public chromeos::PowerManagerClient::Observer, |
| 66 public ui::DisplayConfigurator::Observer, | 66 public display::DisplayConfigurator::Observer, |
| 67 #endif | 67 #endif |
| 68 public aura::WindowTreeHostObserver, | 68 public aura::WindowTreeHostObserver, |
| 69 public ui::internal::InputMethodDelegate { | 69 public ui::internal::InputMethodDelegate { |
| 70 public: | 70 public: |
| 71 ShellDesktopControllerAura(); | 71 ShellDesktopControllerAura(); |
| 72 ~ShellDesktopControllerAura() override; | 72 ~ShellDesktopControllerAura() override; |
| 73 | 73 |
| 74 // DesktopController: | 74 // DesktopController: |
| 75 gfx::Size GetWindowSize() override; | 75 gfx::Size GetWindowSize() override; |
| 76 AppWindow* CreateAppWindow(content::BrowserContext* context, | 76 AppWindow* CreateAppWindow(content::BrowserContext* context, |
| 77 const Extension* extension) override; | 77 const Extension* extension) override; |
| 78 void AddAppWindow(gfx::NativeWindow window) override; | 78 void AddAppWindow(gfx::NativeWindow window) override; |
| 79 void RemoveAppWindow(AppWindow* window) override; | 79 void RemoveAppWindow(AppWindow* window) override; |
| 80 void CloseAppWindows() override; | 80 void CloseAppWindows() override; |
| 81 | 81 |
| 82 // aura::client::WindowParentingClient overrides: | 82 // aura::client::WindowParentingClient overrides: |
| 83 aura::Window* GetDefaultParent(aura::Window* context, | 83 aura::Window* GetDefaultParent(aura::Window* context, |
| 84 aura::Window* window, | 84 aura::Window* window, |
| 85 const gfx::Rect& bounds) override; | 85 const gfx::Rect& bounds) override; |
| 86 | 86 |
| 87 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 88 // chromeos::PowerManagerClient::Observer overrides: | 88 // chromeos::PowerManagerClient::Observer overrides: |
| 89 void PowerButtonEventReceived(bool down, | 89 void PowerButtonEventReceived(bool down, |
| 90 const base::TimeTicks& timestamp) override; | 90 const base::TimeTicks& timestamp) override; |
| 91 | 91 |
| 92 // ui::DisplayConfigurator::Observer overrides. | 92 // display::DisplayConfigurator::Observer overrides. |
| 93 void OnDisplayModeChanged( | 93 void OnDisplayModeChanged( |
| 94 const ui::DisplayConfigurator::DisplayStateList& displays) override; | 94 const display::DisplayConfigurator::DisplayStateList& displays) override; |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 // aura::WindowTreeHostObserver overrides: | 97 // aura::WindowTreeHostObserver overrides: |
| 98 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; | 98 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; |
| 99 | 99 |
| 100 // ui::internal::InputMethodDelegate overrides: | 100 // ui::internal::InputMethodDelegate overrides: |
| 101 ui::EventDispatchDetails DispatchKeyEventPostIME( | 101 ui::EventDispatchDetails DispatchKeyEventPostIME( |
| 102 ui::KeyEvent* key_event) override; | 102 ui::KeyEvent* key_event) override; |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 // 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 |
| 106 // initialize different sets of the clients. | 106 // initialize different sets of the clients. |
| 107 virtual void InitWindowManager(); | 107 virtual void InitWindowManager(); |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 FRIEND_TEST_ALL_PREFIXES(ShellDesktopControllerAuraTest, InputEvents); | 110 FRIEND_TEST_ALL_PREFIXES(ShellDesktopControllerAuraTest, InputEvents); |
| 111 | 111 |
| 112 // Creates the window that hosts the app. | 112 // Creates the window that hosts the app. |
| 113 void CreateRootWindow(); | 113 void CreateRootWindow(); |
| 114 | 114 |
| 115 // Closes and destroys the root window hosting the app. | 115 // Closes and destroys the root window hosting the app. |
| 116 void DestroyRootWindow(); | 116 void DestroyRootWindow(); |
| 117 | 117 |
| 118 // 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 |
| 119 // 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. |
| 120 gfx::Size GetPrimaryDisplaySize(); | 120 gfx::Size GetPrimaryDisplaySize(); |
| 121 | 121 |
| 122 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
| 123 std::unique_ptr<ui::DisplayConfigurator> display_configurator_; | 123 std::unique_ptr<display::DisplayConfigurator> display_configurator_; |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 std::unique_ptr<ShellScreen> screen_; | 126 std::unique_ptr<ShellScreen> screen_; |
| 127 | 127 |
| 128 std::unique_ptr<aura::WindowTreeHost> host_; | 128 std::unique_ptr<aura::WindowTreeHost> host_; |
| 129 | 129 |
| 130 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; | 130 std::unique_ptr<wm::CompoundEventFilter> root_window_event_filter_; |
| 131 | 131 |
| 132 std::unique_ptr<InputMethodEventHandler> input_method_event_handler_; | 132 std::unique_ptr<InputMethodEventHandler> input_method_event_handler_; |
| 133 | 133 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 // NativeAppWindow::Close() deletes the AppWindow. | 147 // NativeAppWindow::Close() deletes the AppWindow. |
| 148 std::vector<AppWindow*> app_windows_; | 148 std::vector<AppWindow*> app_windows_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); | 150 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace extensions | 153 } // namespace extensions |
| 154 | 154 |
| 155 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ | 155 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_ |
| OLD | NEW |