| 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 | 2297 |
| 2298 aura::Window* root_window = window_->GetRootWindow(); | 2298 aura::Window* root_window = window_->GetRootWindow(); |
| 2299 if (!root_window) | 2299 if (!root_window) |
| 2300 return; | 2300 return; |
| 2301 | 2301 |
| 2302 display::Screen* screen = display::Screen::GetScreen(); | 2302 display::Screen* screen = display::Screen::GetScreen(); |
| 2303 DCHECK(screen); | 2303 DCHECK(screen); |
| 2304 | 2304 |
| 2305 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); | 2305 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); |
| 2306 | 2306 |
| 2307 #if defined(OS_WIN) | 2307 #if !defined(OS_CHROMEOS) |
| 2308 // Ignore cursor update messages if the window under the cursor is not us. | 2308 // Ignore cursor update messages if the window under the cursor is not us. |
| 2309 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( | 2309 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( |
| 2310 cursor_screen_point); | 2310 cursor_screen_point); |
| 2311 | 2311 #if defined(OS_WIN) |
| 2312 // On Windows we may fail to retrieve the aura Window at the current cursor | 2312 // On Windows we may fail to retrieve the aura Window at the current cursor |
| 2313 // position. This is because the WindowFromPoint API may return the legacy | 2313 // position. This is because the WindowFromPoint API may return the legacy |
| 2314 // window which is not associated with an aura Window. In this case we need | 2314 // window which is not associated with an aura Window. In this case we need |
| 2315 // to get the aura window for the parent of the legacy window. | 2315 // to get the aura window for the parent of the legacy window. |
| 2316 if (!window_at_screen_point && legacy_render_widget_host_HWND_) { | 2316 if (!window_at_screen_point && legacy_render_widget_host_HWND_) { |
| 2317 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT()); | 2317 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT()); |
| 2318 | 2318 |
| 2319 if (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd()) | 2319 if (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd()) |
| 2320 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent(); | 2320 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent(); |
| 2321 | 2321 |
| 2322 display::win::ScreenWin* screen_win = | 2322 display::win::ScreenWin* screen_win = |
| 2323 static_cast<display::win::ScreenWin*>(screen); | 2323 static_cast<display::win::ScreenWin*>(screen); |
| 2324 window_at_screen_point = screen_win->GetNativeWindowFromHWND( | 2324 window_at_screen_point = screen_win->GetNativeWindowFromHWND( |
| 2325 hwnd_at_point); | 2325 hwnd_at_point); |
| 2326 } | 2326 } |
| 2327 | 2327 #endif // defined(OS_WIN) |
| 2328 if (!window_at_screen_point || | 2328 if (!window_at_screen_point || |
| 2329 (window_at_screen_point->GetRootWindow() != root_window)) { | 2329 (window_at_screen_point->GetRootWindow() != root_window)) { |
| 2330 return; | 2330 return; |
| 2331 } | 2331 } |
| 2332 #elif !defined(OS_CHROMEOS) | 2332 #endif // !defined(OS_CHROMEOS) |
| 2333 if (!screen->IsWindowUnderCursor(window_)) | |
| 2334 return; | |
| 2335 #endif | |
| 2336 | 2333 |
| 2337 gfx::Point root_window_point = cursor_screen_point; | 2334 gfx::Point root_window_point = cursor_screen_point; |
| 2338 aura::client::ScreenPositionClient* screen_position_client = | 2335 aura::client::ScreenPositionClient* screen_position_client = |
| 2339 aura::client::GetScreenPositionClient(root_window); | 2336 aura::client::GetScreenPositionClient(root_window); |
| 2340 if (screen_position_client) { | 2337 if (screen_position_client) { |
| 2341 screen_position_client->ConvertPointFromScreen( | 2338 screen_position_client->ConvertPointFromScreen( |
| 2342 root_window, &root_window_point); | 2339 root_window, &root_window_point); |
| 2343 } | 2340 } |
| 2344 | 2341 |
| 2345 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) | 2342 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 | 2864 |
| 2868 //////////////////////////////////////////////////////////////////////////////// | 2865 //////////////////////////////////////////////////////////////////////////////// |
| 2869 // RenderWidgetHostViewBase, public: | 2866 // RenderWidgetHostViewBase, public: |
| 2870 | 2867 |
| 2871 // static | 2868 // static |
| 2872 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2869 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2873 GetScreenInfoForWindow(results, NULL); | 2870 GetScreenInfoForWindow(results, NULL); |
| 2874 } | 2871 } |
| 2875 | 2872 |
| 2876 } // namespace content | 2873 } // namespace content |
| OLD | NEW |