| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 display::Display HeadlessScreen::GetDisplayNearestWindow( | 143 display::Display HeadlessScreen::GetDisplayNearestWindow( |
| 144 gfx::NativeWindow window) const { | 144 const gfx::NativeWindow window) const { |
| 145 return display_; | 145 return display_; |
| 146 } | 146 } |
| 147 | 147 |
| 148 display::Display HeadlessScreen::GetDisplayNearestPoint( | 148 display::Display HeadlessScreen::GetDisplayNearestPoint( |
| 149 const gfx::Point& point) const { | 149 const gfx::Point& point) const { |
| 150 return display_; | 150 return display_; |
| 151 } | 151 } |
| 152 | 152 |
| 153 display::Display HeadlessScreen::GetDisplayMatching( | 153 display::Display HeadlessScreen::GetDisplayMatching( |
| 154 const gfx::Rect& match_rect) const { | 154 const gfx::Rect& match_rect) const { |
| 155 return display_; | 155 return display_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 display::Display HeadlessScreen::GetPrimaryDisplay() const { | 158 display::Display HeadlessScreen::GetPrimaryDisplay() const { |
| 159 return display_; | 159 return display_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void HeadlessScreen::AddObserver(display::DisplayObserver* observer) {} | 162 void HeadlessScreen::AddObserver(display::DisplayObserver* observer) {} |
| 163 | 163 |
| 164 void HeadlessScreen::RemoveObserver(display::DisplayObserver* observer) {} | 164 void HeadlessScreen::RemoveObserver(display::DisplayObserver* observer) {} |
| 165 | 165 |
| 166 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) | 166 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) |
| 167 : host_(NULL), ui_scale_(1.0f) { | 167 : host_(NULL), ui_scale_(1.0f) { |
| 168 static int64_t synthesized_display_id = 2000; | 168 static int64_t synthesized_display_id = 2000; |
| 169 display_.set_id(synthesized_display_id++); | 169 display_.set_id(synthesized_display_id++); |
| 170 display_.SetScaleAndBounds(1.0f, screen_bounds); | 170 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace headless | 173 } // namespace headless |
| OLD | NEW |