| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/display/display_manager.h" | 12 #include "ash/display/display_manager.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_tree_host_observer.h" | 21 #include "ui/aura/window_tree_host_observer.h" |
| 22 #include "ui/base/ime/input_method.h" |
| 23 #include "ui/base/ime/input_method_delegate.h" |
| 22 #include "ui/gfx/display_observer.h" | 24 #include "ui/gfx/display_observer.h" |
| 23 #include "ui/gfx/geometry/point.h" | 25 #include "ui/gfx/geometry/point.h" |
| 24 | 26 |
| 25 namespace aura { | 27 namespace aura { |
| 26 class Display; | 28 class Display; |
| 27 class WindowTreeHost; | 29 class WindowTreeHost; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace base { | 32 namespace base { |
| 31 class Value; | 33 class Value; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 class DisplayInfo; | 46 class DisplayInfo; |
| 45 class DisplayManager; | 47 class DisplayManager; |
| 46 class FocusActivationStore; | 48 class FocusActivationStore; |
| 47 class MirrorWindowController; | 49 class MirrorWindowController; |
| 48 class RootWindowController; | 50 class RootWindowController; |
| 49 | 51 |
| 50 // DisplayController owns and maintains RootWindows for each attached | 52 // DisplayController owns and maintains RootWindows for each attached |
| 51 // display, keeping them in sync with display configuration changes. | 53 // display, keeping them in sync with display configuration changes. |
| 52 class ASH_EXPORT DisplayController : public gfx::DisplayObserver, | 54 class ASH_EXPORT DisplayController : public gfx::DisplayObserver, |
| 53 public aura::WindowTreeHostObserver, | 55 public aura::WindowTreeHostObserver, |
| 54 public DisplayManager::Delegate { | 56 public DisplayManager::Delegate, |
| 57 public ui::internal::InputMethodDelegate { |
| 55 public: | 58 public: |
| 56 class ASH_EXPORT Observer { | 59 class ASH_EXPORT Observer { |
| 57 public: | 60 public: |
| 58 // Invoked only once after all displays are initialized | 61 // Invoked only once after all displays are initialized |
| 59 // after startup. | 62 // after startup. |
| 60 virtual void OnDisplaysInitialized() {} | 63 virtual void OnDisplaysInitialized() {} |
| 61 | 64 |
| 62 // Invoked when the display configuration change is requested, | 65 // Invoked when the display configuration change is requested, |
| 63 // but before the change is applied to aura/ash. | 66 // but before the change is applied to aura/ash. |
| 64 virtual void OnDisplayConfigurationChanging() {} | 67 virtual void OnDisplayConfigurationChanging() {} |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // aura::WindowTreeHostObserver overrides: | 159 // aura::WindowTreeHostObserver overrides: |
| 157 void OnHostResized(const aura::WindowTreeHost* host) override; | 160 void OnHostResized(const aura::WindowTreeHost* host) override; |
| 158 | 161 |
| 159 // aura::DisplayManager::Delegate overrides: | 162 // aura::DisplayManager::Delegate overrides: |
| 160 void CreateOrUpdateMirroringDisplay( | 163 void CreateOrUpdateMirroringDisplay( |
| 161 const DisplayInfoList& info_list) override; | 164 const DisplayInfoList& info_list) override; |
| 162 void CloseMirroringDisplayIfNotNecessary() override; | 165 void CloseMirroringDisplayIfNotNecessary() override; |
| 163 void PreDisplayConfigurationChange(bool clear_focus) override; | 166 void PreDisplayConfigurationChange(bool clear_focus) override; |
| 164 void PostDisplayConfigurationChange() override; | 167 void PostDisplayConfigurationChange() override; |
| 165 | 168 |
| 169 // ui::internal::InputMethodDelegate overrides: |
| 170 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override; |
| 171 |
| 166 private: | 172 private: |
| 167 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); | 173 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); |
| 168 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); | 174 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); |
| 169 friend class DisplayManager; | 175 friend class DisplayManager; |
| 170 friend class MirrorWindowController; | 176 friend class MirrorWindowController; |
| 171 | 177 |
| 172 // Creates a WindowTreeHost for |display| and stores it in the | 178 // Creates a WindowTreeHost for |display| and stores it in the |
| 173 // |window_tree_hosts_| map. | 179 // |window_tree_hosts_| map. |
| 174 AshWindowTreeHost* AddWindowTreeHostForDisplay( | 180 AshWindowTreeHost* AddWindowTreeHostForDisplay( |
| 175 const gfx::Display& display, | 181 const gfx::Display& display, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 217 |
| 212 // Store the primary window tree host temporarily while replacing | 218 // Store the primary window tree host temporarily while replacing |
| 213 // display. | 219 // display. |
| 214 AshWindowTreeHost* primary_tree_host_for_replace_; | 220 AshWindowTreeHost* primary_tree_host_for_replace_; |
| 215 | 221 |
| 216 scoped_ptr<FocusActivationStore> focus_activation_store_; | 222 scoped_ptr<FocusActivationStore> focus_activation_store_; |
| 217 | 223 |
| 218 scoped_ptr<CursorWindowController> cursor_window_controller_; | 224 scoped_ptr<CursorWindowController> cursor_window_controller_; |
| 219 scoped_ptr<MirrorWindowController> mirror_window_controller_; | 225 scoped_ptr<MirrorWindowController> mirror_window_controller_; |
| 220 | 226 |
| 227 scoped_ptr<ui::InputMethod> input_method_; |
| 228 |
| 221 // Stores the current cursor location (in native coordinates and screen | 229 // Stores the current cursor location (in native coordinates and screen |
| 222 // coordinates respectively). The locations are used to restore the cursor | 230 // coordinates respectively). The locations are used to restore the cursor |
| 223 // location when the display configuration changes and to determine whether | 231 // location when the display configuration changes and to determine whether |
| 224 // the mouse should be moved after a display configuration change. | 232 // the mouse should be moved after a display configuration change. |
| 225 gfx::Point cursor_location_in_native_coords_for_restore_; | 233 gfx::Point cursor_location_in_native_coords_for_restore_; |
| 226 gfx::Point cursor_location_in_screen_coords_for_restore_; | 234 gfx::Point cursor_location_in_screen_coords_for_restore_; |
| 227 | 235 |
| 228 // Stores the cursor's display. The id is used to determine whether the mouse | 236 // Stores the cursor's display. The id is used to determine whether the mouse |
| 229 // should be moved after a display configuration change. | 237 // should be moved after a display configuration change. |
| 230 int64 cursor_display_id_for_restore_; | 238 int64 cursor_display_id_for_restore_; |
| 231 | 239 |
| 232 base::WeakPtrFactory<DisplayController> weak_ptr_factory_; | 240 base::WeakPtrFactory<DisplayController> weak_ptr_factory_; |
| 233 | 241 |
| 234 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 242 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
| 235 }; | 243 }; |
| 236 | 244 |
| 237 } // namespace ash | 245 } // namespace ash |
| 238 | 246 |
| 239 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 247 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
| OLD | NEW |