Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1100)

Side by Side Diff: ui/aura/test/test_screen.cc

Issue 1935083003: gfx::Screen: Replace GetWindowUnderCursor() with IsWindowUnderCursor(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Null checks Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698