| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 gfx::Point TestScreen::GetCursorScreenPoint() { | 123 gfx::Point TestScreen::GetCursorScreenPoint() { |
| 124 return Env::GetInstance()->last_mouse_location(); | 124 return Env::GetInstance()->last_mouse_location(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 gfx::NativeWindow TestScreen::GetWindowUnderCursor() { | 127 gfx::NativeWindow TestScreen::GetWindowUnderCursor() { |
| 128 return GetWindowAtScreenPoint(GetCursorScreenPoint()); | 128 return GetWindowAtScreenPoint(GetCursorScreenPoint()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 gfx::NativeWindow TestScreen::GetWindowAtScreenPoint(const gfx::Point& point) { | 131 gfx::NativeWindow TestScreen::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 132 if (!host_ || !host_->window()) |
| 133 return nullptr; |
| 132 return host_->window()->GetTopWindowContainingPoint(point); | 134 return host_->window()->GetTopWindowContainingPoint(point); |
| 133 } | 135 } |
| 134 | 136 |
| 135 int TestScreen::GetNumDisplays() const { | 137 int TestScreen::GetNumDisplays() const { |
| 136 return 1; | 138 return 1; |
| 137 } | 139 } |
| 138 | 140 |
| 139 std::vector<gfx::Display> TestScreen::GetAllDisplays() const { | 141 std::vector<gfx::Display> TestScreen::GetAllDisplays() const { |
| 140 return std::vector<gfx::Display>(1, display_); | 142 return std::vector<gfx::Display>(1, display_); |
| 141 } | 143 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 165 | 167 |
| 166 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 168 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
| 167 : host_(NULL), | 169 : host_(NULL), |
| 168 ui_scale_(1.0f) { | 170 ui_scale_(1.0f) { |
| 169 static int64 synthesized_display_id = 2000; | 171 static int64 synthesized_display_id = 2000; |
| 170 display_.set_id(synthesized_display_id++); | 172 display_.set_id(synthesized_display_id++); |
| 171 display_.SetScaleAndBounds(1.0f, screen_bounds); | 173 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 172 } | 174 } |
| 173 | 175 |
| 174 } // namespace aura | 176 } // namespace aura |
| OLD | NEW |