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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/root_window_settings.h" | 10 #include "ash/root_window_settings.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 virtual int GetNumDisplays() const OVERRIDE { | 87 virtual int GetNumDisplays() const OVERRIDE { |
88 return display_list_.size(); | 88 return display_list_.size(); |
89 } | 89 } |
90 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { | 90 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { |
91 return display_list_; | 91 return display_list_; |
92 } | 92 } |
93 virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) | 93 virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) |
94 const OVERRIDE { | 94 const OVERRIDE { |
95 return primary_display_; | 95 return primary_display_; |
96 } | 96 } |
| 97 virtual bool GetDisplayColorProfile(gfx::NativeView view, |
| 98 std::vector<char>* color_profile) const OVERRIDE { |
| 99 return false; |
| 100 } |
97 virtual gfx::Display GetDisplayNearestPoint( | 101 virtual gfx::Display GetDisplayNearestPoint( |
98 const gfx::Point& point) const OVERRIDE { | 102 const gfx::Point& point) const OVERRIDE { |
99 return FindDisplayNearestPoint(display_list_, point); | 103 return FindDisplayNearestPoint(display_list_, point); |
100 } | 104 } |
101 virtual gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) | 105 virtual gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) |
102 const OVERRIDE { | 106 const OVERRIDE { |
103 const gfx::Display* matching = | 107 const gfx::Display* matching = |
104 FindDisplayMatching(display_list_, match_rect); | 108 FindDisplayMatching(display_list_, match_rect); |
105 // Fallback to the primary display if there is no matching display. | 109 // Fallback to the primary display if there is no matching display. |
106 return matching ? *matching : GetPrimaryDisplay(); | 110 return matching ? *matching : GetPrimaryDisplay(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 DCHECK(id != gfx::Display::kInvalidDisplayID); | 245 DCHECK(id != gfx::Display::kInvalidDisplayID); |
242 | 246 |
243 DisplayManager* display_manager = GetDisplayManager(); | 247 DisplayManager* display_manager = GetDisplayManager(); |
244 // RootWindow needs Display to determine its device scale factor | 248 // RootWindow needs Display to determine its device scale factor |
245 // for non desktop display. | 249 // for non desktop display. |
246 if (display_manager->non_desktop_display().id() == id) | 250 if (display_manager->non_desktop_display().id() == id) |
247 return display_manager->non_desktop_display(); | 251 return display_manager->non_desktop_display(); |
248 return display_manager->GetDisplayForId(id); | 252 return display_manager->GetDisplayForId(id); |
249 } | 253 } |
250 | 254 |
| 255 bool ScreenAsh::GetDisplayColorProfile( |
| 256 gfx::NativeView view, std::vector<char>* color_profile) const { |
| 257 // TODO(port): consider display color profile support. |
| 258 return false; |
| 259 } |
| 260 |
251 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { | 261 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { |
252 const gfx::Display& display = | 262 const gfx::Display& display = |
253 GetDisplayManager()->FindDisplayContainingPoint(point); | 263 GetDisplayManager()->FindDisplayContainingPoint(point); |
254 if (display.is_valid()) | 264 if (display.is_valid()) |
255 return display; | 265 return display; |
256 // Fallback to the display that has the shortest Manhattan distance from | 266 // Fallback to the display that has the shortest Manhattan distance from |
257 // the |point|. This is correct in the only areas that matter, namely in the | 267 // the |point|. This is correct in the only areas that matter, namely in the |
258 // corners between the physical screens. | 268 // corners between the physical screens. |
259 return FindDisplayNearestPoint(GetDisplayManager()->displays(), point); | 269 return FindDisplayNearestPoint(GetDisplayManager()->displays(), point); |
260 } | 270 } |
(...skipping 18 matching lines...) Expand all Loading... |
279 | 289 |
280 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { | 290 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { |
281 observers_.RemoveObserver(observer); | 291 observers_.RemoveObserver(observer); |
282 } | 292 } |
283 | 293 |
284 gfx::Screen* ScreenAsh::CloneForShutdown() { | 294 gfx::Screen* ScreenAsh::CloneForShutdown() { |
285 return new ScreenForShutdown(this); | 295 return new ScreenForShutdown(this); |
286 } | 296 } |
287 | 297 |
288 } // namespace ash | 298 } // namespace ash |
OLD | NEW |