OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 void TestScreen::OnWindowDestroying(Window* window) { | 120 void TestScreen::OnWindowDestroying(Window* window) { |
121 if (host_->window() == window) | 121 if (host_->window() == window) |
122 host_ = NULL; | 122 host_ = NULL; |
123 } | 123 } |
124 | 124 |
125 gfx::Point TestScreen::GetCursorScreenPoint() { | 125 gfx::Point TestScreen::GetCursorScreenPoint() { |
126 return Env::GetInstance()->last_mouse_location(); | 126 return Env::GetInstance()->last_mouse_location(); |
127 } | 127 } |
128 | 128 |
129 gfx::NativeWindow TestScreen::GetWindowUnderCursor() { | 129 bool TestScreen::IsWindowUnderCursor(gfx::NativeWindow window) { |
130 return GetWindowAtScreenPoint(GetCursorScreenPoint()); | 130 return GetWindowAtScreenPoint(GetCursorScreenPoint()) == window; |
131 } | 131 } |
132 | 132 |
133 gfx::NativeWindow TestScreen::GetWindowAtScreenPoint(const gfx::Point& point) { | 133 gfx::NativeWindow TestScreen::GetWindowAtScreenPoint(const gfx::Point& point) { |
134 if (!host_ || !host_->window()) | 134 if (!host_ || !host_->window()) |
135 return nullptr; | 135 return nullptr; |
136 return host_->window()->GetTopWindowContainingPoint(point); | 136 return host_->window()->GetTopWindowContainingPoint(point); |
137 } | 137 } |
138 | 138 |
139 int TestScreen::GetNumDisplays() const { | 139 int TestScreen::GetNumDisplays() const { |
140 return 1; | 140 return 1; |
(...skipping 28 matching lines...) Expand all Loading... |
169 | 169 |
170 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 170 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
171 : host_(NULL), | 171 : host_(NULL), |
172 ui_scale_(1.0f) { | 172 ui_scale_(1.0f) { |
173 static int64_t synthesized_display_id = 2000; | 173 static int64_t synthesized_display_id = 2000; |
174 display_.set_id(synthesized_display_id++); | 174 display_.set_id(synthesized_display_id++); |
175 display_.SetScaleAndBounds(1.0f, screen_bounds); | 175 display_.SetScaleAndBounds(1.0f, screen_bounds); |
176 } | 176 } |
177 | 177 |
178 } // namespace aura | 178 } // namespace aura |
OLD | NEW |