| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 void RenderWidgetHostViewAura::Hide() { | 422 void RenderWidgetHostViewAura::Hide() { |
| 423 window_->Hide(); | 423 window_->Hide(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 bool RenderWidgetHostViewAura::IsShowing() { | 426 bool RenderWidgetHostViewAura::IsShowing() { |
| 427 return window_->IsVisible(); | 427 return window_->IsVisible(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 430 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 431 return window_->GetBoundsInRootWindow(); | 431 return window_->GetBoundsInScreen(); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 434 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
| 435 current_cursor_ = cursor; | 435 current_cursor_ = cursor; |
| 436 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window_); | 436 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window_); |
| 437 current_cursor_.SetScaleFactor(display.device_scale_factor()); | 437 current_cursor_.SetScaleFactor(display.device_scale_factor()); |
| 438 UpdateCursorIfOverSelf(); | 438 UpdateCursorIfOverSelf(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 441 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 // associated with the window, but just in case. | 1621 // associated with the window, but just in case. |
| 1622 DetachFromInputMethod(); | 1622 DetachFromInputMethod(); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 1625 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 1626 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); | 1626 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); |
| 1627 aura::RootWindow* root_window = window_->GetRootWindow(); | 1627 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 1628 if (!root_window) | 1628 if (!root_window) |
| 1629 return; | 1629 return; |
| 1630 | 1630 |
| 1631 if (root_window->GetEventHandlerForPoint(screen_point) != window_) | 1631 gfx::Rect screen_rect = GetViewBounds(); |
| 1632 gfx::Point local_point = screen_point; |
| 1633 local_point.Offset(-screen_rect.x(), -screen_rect.y()); |
| 1634 |
| 1635 if (root_window->GetEventHandlerForPoint(local_point) != window_) |
| 1632 return; | 1636 return; |
| 1633 | 1637 |
| 1634 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 1638 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
| 1635 if (is_loading_) | 1639 if (is_loading_) |
| 1636 cursor = ui::kCursorPointer; | 1640 cursor = ui::kCursorPointer; |
| 1637 | 1641 |
| 1638 aura::client::CursorClient* cursor_client = | 1642 aura::client::CursorClient* cursor_client = |
| 1639 aura::client::GetCursorClient(root_window); | 1643 aura::client::GetCursorClient(root_window); |
| 1640 if (cursor_client) | 1644 if (cursor_client) |
| 1641 cursor_client->SetCursor(cursor); | 1645 cursor_client->SetCursor(cursor); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 RenderWidgetHost* widget) { | 1791 RenderWidgetHost* widget) { |
| 1788 return new RenderWidgetHostViewAura(widget); | 1792 return new RenderWidgetHostViewAura(widget); |
| 1789 } | 1793 } |
| 1790 | 1794 |
| 1791 // static | 1795 // static |
| 1792 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1796 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1793 GetScreenInfoForWindow(results, NULL); | 1797 GetScreenInfoForWindow(results, NULL); |
| 1794 } | 1798 } |
| 1795 | 1799 |
| 1796 } // namespace content | 1800 } // namespace content |
| OLD | NEW |