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 #include "headless/lib/browser/headless_screen.h" | 5 #include "headless/lib/browser/headless_screen.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 int HeadlessScreen::GetNumDisplays() const { | 135 int HeadlessScreen::GetNumDisplays() const { |
136 return 1; | 136 return 1; |
137 } | 137 } |
138 | 138 |
139 std::vector<display::Display> HeadlessScreen::GetAllDisplays() const { | 139 std::vector<display::Display> HeadlessScreen::GetAllDisplays() const { |
140 return std::vector<display::Display>(1, display_); | 140 return std::vector<display::Display>(1, display_); |
141 } | 141 } |
142 | 142 |
| 143 bool HeadlessScreen::GetDisplayWithDisplayId(int64_t display_id, |
| 144 display::Display* display) const { |
| 145 if (display_.id() == display_id) { |
| 146 *display = display_; |
| 147 return true; |
| 148 } |
| 149 return false; |
| 150 } |
| 151 |
143 display::Display HeadlessScreen::GetDisplayNearestWindow( | 152 display::Display HeadlessScreen::GetDisplayNearestWindow( |
144 gfx::NativeWindow window) const { | 153 gfx::NativeWindow window) const { |
145 return display_; | 154 return display_; |
146 } | 155 } |
147 | 156 |
148 display::Display HeadlessScreen::GetDisplayNearestPoint( | 157 display::Display HeadlessScreen::GetDisplayNearestPoint( |
149 const gfx::Point& point) const { | 158 const gfx::Point& point) const { |
150 return display_; | 159 return display_; |
151 } | 160 } |
152 | 161 |
(...skipping 11 matching lines...) Expand all Loading... |
164 void HeadlessScreen::RemoveObserver(display::DisplayObserver* observer) {} | 173 void HeadlessScreen::RemoveObserver(display::DisplayObserver* observer) {} |
165 | 174 |
166 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) | 175 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) |
167 : host_(NULL), ui_scale_(1.0f) { | 176 : host_(NULL), ui_scale_(1.0f) { |
168 static int64_t synthesized_display_id = 2000; | 177 static int64_t synthesized_display_id = 2000; |
169 display_.set_id(synthesized_display_id++); | 178 display_.set_id(synthesized_display_id++); |
170 display_.SetScaleAndBounds(1.0f, screen_bounds); | 179 display_.SetScaleAndBounds(1.0f, screen_bounds); |
171 } | 180 } |
172 | 181 |
173 } // namespace headless | 182 } // namespace headless |
OLD | NEW |