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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 void HeadlessScreen::OnWindowDestroying(aura::Window* window) { | 116 void HeadlessScreen::OnWindowDestroying(aura::Window* window) { |
117 if (host_->window() == window) | 117 if (host_->window() == window) |
118 host_ = NULL; | 118 host_ = NULL; |
119 } | 119 } |
120 | 120 |
121 gfx::Point HeadlessScreen::GetCursorScreenPoint() { | 121 gfx::Point HeadlessScreen::GetCursorScreenPoint() { |
122 return aura::Env::GetInstance()->last_mouse_location(); | 122 return aura::Env::GetInstance()->last_mouse_location(); |
123 } | 123 } |
124 | 124 |
125 gfx::NativeWindow HeadlessScreen::GetWindowUnderCursor() { | 125 bool HeadlessScreen::IsWindowUnderCursor(gfx::NativeWindow window) { |
126 return GetWindowAtScreenPoint(GetCursorScreenPoint()); | 126 return GetWindowAtScreenPoint(GetCursorScreenPoint()) == window; |
127 } | 127 } |
128 | 128 |
129 gfx::NativeWindow HeadlessScreen::GetWindowAtScreenPoint( | 129 gfx::NativeWindow HeadlessScreen::GetWindowAtScreenPoint( |
130 const gfx::Point& point) { | 130 const gfx::Point& point) { |
131 if (!host_ || !host_->window()) | 131 if (!host_ || !host_->window()) |
132 return nullptr; | 132 return nullptr; |
133 return host_->window()->GetTopWindowContainingPoint(point); | 133 return host_->window()->GetTopWindowContainingPoint(point); |
134 } | 134 } |
135 | 135 |
136 int HeadlessScreen::GetNumDisplays() const { | 136 int HeadlessScreen::GetNumDisplays() const { |
(...skipping 28 matching lines...) Expand all Loading... |
165 void HeadlessScreen::RemoveObserver(gfx::DisplayObserver* observer) {} | 165 void HeadlessScreen::RemoveObserver(gfx::DisplayObserver* observer) {} |
166 | 166 |
167 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) | 167 HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) |
168 : host_(NULL), ui_scale_(1.0f) { | 168 : host_(NULL), ui_scale_(1.0f) { |
169 static int64_t synthesized_display_id = 2000; | 169 static int64_t synthesized_display_id = 2000; |
170 display_.set_id(synthesized_display_id++); | 170 display_.set_id(synthesized_display_id++); |
171 display_.SetScaleAndBounds(1.0f, screen_bounds); | 171 display_.SetScaleAndBounds(1.0f, screen_bounds); |
172 } | 172 } |
173 | 173 |
174 } // namespace headless | 174 } // namespace headless |
OLD | NEW |