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 #include "ash/display/screen_ash.h" | 5 #include "ash/display/screen_ash.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/wm/root_window_finder.h" | 8 #include "ash/common/wm/root_window_finder.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/display/window_tree_host_manager.h" | 10 #include "ash/display/window_tree_host_manager.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 display::Display ScreenAsh::GetDisplayNearestPoint( | 153 display::Display ScreenAsh::GetDisplayNearestPoint( |
154 const gfx::Point& point) const { | 154 const gfx::Point& point) const { |
155 const display::Display& display = | 155 const display::Display& display = |
156 GetDisplayManager()->FindDisplayContainingPoint(point); | 156 GetDisplayManager()->FindDisplayContainingPoint(point); |
157 if (display.is_valid()) | 157 if (display.is_valid()) |
158 return display; | 158 return display; |
159 // Fallback to the display that has the shortest Manhattan distance from | 159 // Fallback to the display that has the shortest Manhattan distance from |
160 // the |point|. This is correct in the only areas that matter, namely in the | 160 // the |point|. This is correct in the only areas that matter, namely in the |
161 // corners between the physical screens. | 161 // corners between the physical screens. |
162 return *display::FindDisplayNearestPoint( | 162 return *display::FindDisplayNearestPoint( |
163 GetDisplayManager()->active_display_list(), point); | 163 GetDisplayManager()->active_only_display_list(), point); |
164 } | 164 } |
165 | 165 |
166 display::Display ScreenAsh::GetDisplayMatching( | 166 display::Display ScreenAsh::GetDisplayMatching( |
167 const gfx::Rect& match_rect) const { | 167 const gfx::Rect& match_rect) const { |
168 if (match_rect.IsEmpty()) | 168 if (match_rect.IsEmpty()) |
169 return GetDisplayNearestPoint(match_rect.origin()); | 169 return GetDisplayNearestPoint(match_rect.origin()); |
170 const display::Display* matching = | 170 const display::Display* matching = |
171 display::FindDisplayWithBiggestIntersection( | 171 display::FindDisplayWithBiggestIntersection( |
172 GetDisplayManager()->active_display_list(), match_rect); | 172 GetDisplayManager()->active_only_display_list(), match_rect); |
173 // Fallback to the primary display if there is no matching display. | 173 // Fallback to the primary display if there is no matching display. |
174 return matching ? *matching : GetPrimaryDisplay(); | 174 return matching ? *matching : GetPrimaryDisplay(); |
175 } | 175 } |
176 | 176 |
177 display::Display ScreenAsh::GetPrimaryDisplay() const { | 177 display::Display ScreenAsh::GetPrimaryDisplay() const { |
178 return GetDisplayManager()->GetDisplayForId( | 178 return GetDisplayManager()->GetDisplayForId( |
179 WindowTreeHostManager::GetPrimaryDisplayId()); | 179 WindowTreeHostManager::GetPrimaryDisplayId()); |
180 } | 180 } |
181 | 181 |
182 void ScreenAsh::AddObserver(display::DisplayObserver* observer) { | 182 void ScreenAsh::AddObserver(display::DisplayObserver* observer) { |
183 observers_.AddObserver(observer); | 183 observers_.AddObserver(observer); |
184 } | 184 } |
185 | 185 |
186 void ScreenAsh::RemoveObserver(display::DisplayObserver* observer) { | 186 void ScreenAsh::RemoveObserver(display::DisplayObserver* observer) { |
187 observers_.RemoveObserver(observer); | 187 observers_.RemoveObserver(observer); |
188 } | 188 } |
189 | 189 |
190 display::Screen* ScreenAsh::CloneForShutdown() { | 190 display::Screen* ScreenAsh::CloneForShutdown() { |
191 return new ScreenForShutdown(this); | 191 return new ScreenForShutdown(this); |
192 } | 192 } |
193 | 193 |
194 } // namespace ash | 194 } // namespace ash |
OLD | NEW |