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 #include "ash/display/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return displays_[0]; | 163 return displays_[0]; |
164 const RootWindow* root = window->GetRootWindow(); | 164 const RootWindow* root = window->GetRootWindow(); |
165 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); | 165 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); |
166 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); | 166 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); |
167 } | 167 } |
168 | 168 |
169 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( | 169 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( |
170 const gfx::Point& point) const { | 170 const gfx::Point& point) const { |
171 // Fallback to the primary display if there is no root display containing | 171 // Fallback to the primary display if there is no root display containing |
172 // the |point|. | 172 // the |point|. |
173 gfx::Display display = FindDisplayContainingPoint(point); | 173 const gfx::Display& display = FindDisplayContainingPoint(point); |
174 return display.is_valid() ? display : displays_[0]; | 174 return display.is_valid() ? display : displays_[0]; |
175 } | 175 } |
176 | 176 |
177 const gfx::Display& MultiDisplayManager::GetDisplayMatching( | 177 const gfx::Display& MultiDisplayManager::GetDisplayMatching( |
178 const gfx::Rect& rect) const { | 178 const gfx::Rect& rect) const { |
179 if (rect.IsEmpty()) | 179 if (rect.IsEmpty()) |
180 return GetDisplayNearestPoint(rect.origin()); | 180 return GetDisplayNearestPoint(rect.origin()); |
181 | 181 |
182 int max = 0; | 182 int max = 0; |
183 const gfx::Display* matching = 0; | 183 const gfx::Display* matching = 0; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 const gfx::Insets insets = display.GetWorkAreaInsets(); | 304 const gfx::Insets insets = display.GetWorkAreaInsets(); |
305 const gfx::Rect& native_bounds = display.bounds_in_pixel(); | 305 const gfx::Rect& native_bounds = display.bounds_in_pixel(); |
306 display.SetScaleAndBounds(display.device_scale_factor(), native_bounds); | 306 display.SetScaleAndBounds(display.device_scale_factor(), native_bounds); |
307 display.UpdateWorkAreaFromInsets(insets); | 307 display.UpdateWorkAreaFromInsets(insets); |
308 displays_.push_back(display); | 308 displays_.push_back(display); |
309 } | 309 } |
310 | 310 |
311 } // namespace internal | 311 } // namespace internal |
312 } // namespace ash | 312 } // namespace ash |
OLD | NEW |