Chromium Code Reviews| 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 "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/gtest_prod_util.h" | |
| 15 #include "base/observer_list.h" | |
| 14 #include "ui/aura/display_observer.h" | 16 #include "ui/aura/display_observer.h" |
| 15 #include "ui/aura/display_manager.h" | 17 #include "ui/aura/display_manager.h" |
| 16 | 18 |
| 17 namespace aura { | 19 namespace aura { |
| 18 class Display; | 20 class Display; |
| 19 class RootWindow; | 21 class RootWindow; |
| 20 } | 22 } |
| 21 | 23 |
| 22 namespace base { | 24 namespace base { |
| 23 class Value; | 25 class Value; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 54 | 56 |
| 55 // The offset of the position of the secondary display. The offset is | 57 // The offset of the position of the secondary display. The offset is |
| 56 // based on the top/left edge of the primary display. | 58 // based on the top/left edge of the primary display. |
| 57 int offset; | 59 int offset; |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 // DisplayController owns and maintains RootWindows for each attached | 62 // DisplayController owns and maintains RootWindows for each attached |
| 61 // display, keeping them in sync with display configuration changes. | 63 // display, keeping them in sync with display configuration changes. |
| 62 class ASH_EXPORT DisplayController : public aura::DisplayObserver { | 64 class ASH_EXPORT DisplayController : public aura::DisplayObserver { |
| 63 public: | 65 public: |
| 66 class Observer { | |
| 67 public: | |
| 68 // Invoked when the display configuration change is requested, | |
| 69 // but before the change is applied to aura/ash. | |
| 70 virtual void OnDisplayConfigurationChanging() = 0; | |
| 71 }; | |
|
sky
2012/09/05 22:45:37
protected virtual destructor.
| |
| 72 | |
| 64 DisplayController(); | 73 DisplayController(); |
| 65 virtual ~DisplayController(); | 74 virtual ~DisplayController(); |
| 66 | 75 |
| 67 // Initializes primary display. | 76 // Initializes primary display. |
| 68 void InitPrimaryDisplay(); | 77 void InitPrimaryDisplay(); |
| 69 | 78 |
| 70 // Initialize secondary displays. | 79 // Initialize secondary displays. |
| 71 void InitSecondaryDisplays(); | 80 void InitSecondaryDisplays(); |
| 72 | 81 |
| 82 // Add/Remove observers. | |
| 83 void AddObserver(Observer* observer); | |
| 84 void RemoveObserver(Observer* observer); | |
| 85 | |
| 73 // Returns the root window for primary display. | 86 // Returns the root window for primary display. |
| 74 aura::RootWindow* GetPrimaryRootWindow(); | 87 aura::RootWindow* GetPrimaryRootWindow(); |
| 75 | 88 |
| 76 // Returns the root window for |display_id|. | 89 // Returns the root window for |display_id|. |
| 77 aura::RootWindow* GetRootWindowForDisplayId(int64 id); | 90 aura::RootWindow* GetRootWindowForDisplayId(int64 id); |
| 78 | 91 |
| 79 // Closes all child windows in the all root windows. | 92 // Closes all child windows in the all root windows. |
| 80 void CloseChildWindows(); | 93 void CloseChildWindows(); |
| 81 | 94 |
| 82 // Returns all root windows. In non extended desktop mode, this | 95 // Returns all root windows. In non extended desktop mode, this |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 104 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 117 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
| 105 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; | 118 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
| 106 | 119 |
| 107 private: | 120 private: |
| 108 // Creates a root window for |display| and stores it in the |root_windows_| | 121 // Creates a root window for |display| and stores it in the |root_windows_| |
| 109 // map. | 122 // map. |
| 110 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); | 123 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); |
| 111 | 124 |
| 112 void UpdateDisplayBoundsForLayout(); | 125 void UpdateDisplayBoundsForLayout(); |
| 113 | 126 |
| 127 void NotifyDisplayConfigurationChanging(); | |
| 128 | |
| 114 // The mapping from display ID to its root window. | 129 // The mapping from display ID to its root window. |
| 115 std::map<int64, aura::RootWindow*> root_windows_; | 130 std::map<int64, aura::RootWindow*> root_windows_; |
| 116 | 131 |
| 117 // The default display layout. | 132 // The default display layout. |
| 118 DisplayLayout default_display_layout_; | 133 DisplayLayout default_display_layout_; |
| 119 | 134 |
| 120 // Per-device display layout. | 135 // Per-device display layout. |
| 121 std::map<std::string, DisplayLayout> secondary_layouts_; | 136 std::map<std::string, DisplayLayout> secondary_layouts_; |
| 122 | 137 |
| 138 ObserverList<Observer> observers_; | |
| 139 | |
| 123 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 140 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
| 124 }; | 141 }; |
| 125 | 142 |
| 126 } // namespace ash | 143 } // namespace ash |
| 127 | 144 |
| 128 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 145 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
| OLD | NEW |