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" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "ui/aura/display_observer.h" | 16 #include "ui/gfx/display_observer.h" |
17 #include "ui/aura/display_manager.h" | |
18 #include "ui/gfx/display.h" | 17 #include "ui/gfx/display.h" |
19 | 18 |
20 namespace aura { | 19 namespace aura { |
21 class Display; | 20 class Display; |
22 class RootWindow; | 21 class RootWindow; |
23 } | 22 } |
24 | 23 |
25 namespace base { | 24 namespace base { |
26 class Value; | 25 class Value; |
27 template <typename T> class JSONValueConverter; | 26 template <typename T> class JSONValueConverter; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // The offset of the position of the secondary display. The offset is | 60 // The offset of the position of the secondary display. The offset is |
62 // based on the top/left edge of the primary display. | 61 // based on the top/left edge of the primary display. |
63 int offset; | 62 int offset; |
64 | 63 |
65 // Returns string representation of the layout for debugging/testing. | 64 // Returns string representation of the layout for debugging/testing. |
66 std::string ToString() const; | 65 std::string ToString() const; |
67 }; | 66 }; |
68 | 67 |
69 // DisplayController owns and maintains RootWindows for each attached | 68 // DisplayController owns and maintains RootWindows for each attached |
70 // display, keeping them in sync with display configuration changes. | 69 // display, keeping them in sync with display configuration changes. |
71 class ASH_EXPORT DisplayController : public aura::DisplayObserver { | 70 class ASH_EXPORT DisplayController : public gfx::DisplayObserver { |
72 public: | 71 public: |
73 class ASH_EXPORT Observer { | 72 class ASH_EXPORT Observer { |
74 public: | 73 public: |
75 // Invoked when the display configuration change is requested, | 74 // Invoked when the display configuration change is requested, |
76 // but before the change is applied to aura/ash. | 75 // but before the change is applied to aura/ash. |
77 virtual void OnDisplayConfigurationChanging() = 0; | 76 virtual void OnDisplayConfigurationChanging() = 0; |
78 | 77 |
79 protected: | 78 protected: |
80 virtual ~Observer() {} | 79 virtual ~Observer() {} |
81 }; | 80 }; |
82 | 81 |
83 DisplayController(); | 82 DisplayController(); |
84 virtual ~DisplayController(); | 83 virtual ~DisplayController(); |
85 | 84 |
86 // Gets primary display. This information is stored in global | 85 // Gets primary display. This information is stored in global |
87 // object as this can be accessed after Shell is closed. | 86 // object as this can be accessed after Shell is closed. |
88 static const gfx::Display& GetPrimaryDisplay(); | 87 static const gfx::Display& GetPrimaryDisplay(); |
89 | 88 |
| 89 // True if the primary display has been initialized. |
| 90 static bool HasPrimaryDisplay(); |
| 91 |
90 // Initializes primary display. | 92 // Initializes primary display. |
91 void InitPrimaryDisplay(); | 93 void InitPrimaryDisplay(); |
92 | 94 |
93 // Initialize secondary displays. | 95 // Initialize secondary displays. |
94 void InitSecondaryDisplays(); | 96 void InitSecondaryDisplays(); |
95 | 97 |
96 // Add/Remove observers. | 98 // Add/Remove observers. |
97 void AddObserver(Observer* observer); | 99 void AddObserver(Observer* observer); |
98 void RemoveObserver(Observer* observer); | 100 void RemoveObserver(Observer* observer); |
99 | 101 |
(...skipping 19 matching lines...) Expand all Loading... |
119 | 121 |
120 // Returns all root windows. In non extended desktop mode, this | 122 // Returns all root windows. In non extended desktop mode, this |
121 // returns the primary root window only. | 123 // returns the primary root window only. |
122 std::vector<aura::RootWindow*> GetAllRootWindows(); | 124 std::vector<aura::RootWindow*> GetAllRootWindows(); |
123 | 125 |
124 // Returns all oot window controllers. In non extended desktop | 126 // Returns all oot window controllers. In non extended desktop |
125 // mode, this return a RootWindowController for the primary root window only. | 127 // mode, this return a RootWindowController for the primary root window only. |
126 std::vector<internal::RootWindowController*> GetAllRootWindowControllers(); | 128 std::vector<internal::RootWindowController*> GetAllRootWindowControllers(); |
127 | 129 |
128 // Returns the current overscan insets for the specified |display_id|. See | 130 // Returns the current overscan insets for the specified |display_id|. See |
129 // multi_display_manager.h for the details. | 131 // display_manager.h for the details. |
130 gfx::Insets GetOverscanInsets(int64 display_id) const; | 132 gfx::Insets GetOverscanInsets(int64 display_id) const; |
131 | 133 |
132 const DisplayLayout& default_display_layout() const { | 134 const DisplayLayout& default_display_layout() const { |
133 return default_display_layout_; | 135 return default_display_layout_; |
134 } | 136 } |
135 void SetDefaultDisplayLayout(const DisplayLayout& layout); | 137 void SetDefaultDisplayLayout(const DisplayLayout& layout); |
136 | 138 |
137 // Sets/gets the display layout for the specified display or display | 139 // Sets/gets the display layout for the specified display or display |
138 // name. Getter returns the default value in case it doesn't have | 140 // name. Getter returns the default value in case it doesn't have |
139 // its own layout yet. | 141 // its own layout yet. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 int64 desired_primary_display_id_; | 175 int64 desired_primary_display_id_; |
174 | 176 |
175 ObserverList<Observer> observers_; | 177 ObserverList<Observer> observers_; |
176 | 178 |
177 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 179 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
178 }; | 180 }; |
179 | 181 |
180 } // namespace ash | 182 } // namespace ash |
181 | 183 |
182 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 184 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |