OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This has to be before any other includes, else default is picked up. | 5 // This has to be before any other includes, else default is picked up. |
6 // See base/logging for details on this. | 6 // See base/logging for details on this. |
7 #define NOTIMPLEMENTED_POLICY 5 | 7 #define NOTIMPLEMENTED_POLICY 5 |
8 | 8 |
9 #include "ui/display/screen_base.h" | 9 #include "ui/display/screen_base.h" |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 gfx::NativeWindow ScreenBase::GetWindowAtScreenPoint(const gfx::Point& point) { | 48 gfx::NativeWindow ScreenBase::GetWindowAtScreenPoint(const gfx::Point& point) { |
49 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
50 return nullptr; | 50 return nullptr; |
51 } | 51 } |
52 | 52 |
53 display::Display ScreenBase::GetPrimaryDisplay() const { | 53 display::Display ScreenBase::GetPrimaryDisplay() const { |
54 return *display_list_.GetPrimaryDisplayIterator(); | 54 return *display_list_.GetPrimaryDisplayIterator(); |
55 } | 55 } |
56 | 56 |
57 bool ScreenBase::GetDisplayWithDisplayId(int64_t display_id, | |
58 display::Display* display) const { | |
59 for (display::Display display_in_list : GetAllDisplays()) { | |
sadrul
2016/09/23 19:51:12
Iterate over display_list_.displays() to avoid ext
riajiang
2016/10/05 14:54:11
Done.
| |
60 if (display_in_list.id() == display_id) { | |
61 *display = display_in_list; | |
62 return true; | |
63 } | |
64 } | |
65 return false; | |
66 } | |
67 | |
57 display::Display ScreenBase::GetDisplayNearestWindow( | 68 display::Display ScreenBase::GetDisplayNearestWindow( |
58 gfx::NativeView view) const { | 69 gfx::NativeView view) const { |
59 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
60 return *display_list_.GetPrimaryDisplayIterator(); | 71 return *display_list_.GetPrimaryDisplayIterator(); |
61 } | 72 } |
62 | 73 |
63 display::Display ScreenBase::GetDisplayNearestPoint( | 74 display::Display ScreenBase::GetDisplayNearestPoint( |
64 const gfx::Point& point) const { | 75 const gfx::Point& point) const { |
65 return *display::FindDisplayNearestPoint(display_list_.displays(), point); | 76 return *display::FindDisplayNearestPoint(display_list_.displays(), point); |
66 } | 77 } |
(...skipping 15 matching lines...) Expand all Loading... | |
82 | 93 |
83 void ScreenBase::AddObserver(display::DisplayObserver* observer) { | 94 void ScreenBase::AddObserver(display::DisplayObserver* observer) { |
84 display_list_.AddObserver(observer); | 95 display_list_.AddObserver(observer); |
85 } | 96 } |
86 | 97 |
87 void ScreenBase::RemoveObserver(display::DisplayObserver* observer) { | 98 void ScreenBase::RemoveObserver(display::DisplayObserver* observer) { |
88 display_list_.RemoveObserver(observer); | 99 display_list_.RemoveObserver(observer); |
89 } | 100 } |
90 | 101 |
91 } // namespace display | 102 } // namespace display |
OLD | NEW |