| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 void RenderWidgetHostViewAura::Hide() { | 421 void RenderWidgetHostViewAura::Hide() { |
| 422 window_->Hide(); | 422 window_->Hide(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 bool RenderWidgetHostViewAura::IsShowing() { | 425 bool RenderWidgetHostViewAura::IsShowing() { |
| 426 return window_->IsVisible(); | 426 return window_->IsVisible(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 429 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 430 return window_->GetBoundsInRootWindow(); | 430 return window_->GetBoundsInScreen(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 433 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
| 434 current_cursor_ = cursor; | 434 current_cursor_ = cursor; |
| 435 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window_); | 435 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window_); |
| 436 current_cursor_.SetScaleFactor(display.device_scale_factor()); | 436 current_cursor_.SetScaleFactor(display.device_scale_factor()); |
| 437 UpdateCursorIfOverSelf(); | 437 UpdateCursorIfOverSelf(); |
| 438 } | 438 } |
| 439 | 439 |
| 440 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 440 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 // associated with the window, but just in case. | 1603 // associated with the window, but just in case. |
| 1604 DetachFromInputMethod(); | 1604 DetachFromInputMethod(); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 1607 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 1608 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); | 1608 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); |
| 1609 aura::RootWindow* root_window = window_->GetRootWindow(); | 1609 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 1610 if (!root_window) | 1610 if (!root_window) |
| 1611 return; | 1611 return; |
| 1612 | 1612 |
| 1613 if (root_window->GetEventHandlerForPoint(screen_point) != window_) | 1613 gfx::Rect screen_rect = GetViewBounds(); |
| 1614 gfx::Point local_point = screen_point; |
| 1615 local_point.Offset(-screen_rect.x(), -screen_rect.y()); |
| 1616 |
| 1617 if (root_window->GetEventHandlerForPoint(local_point) != window_) |
| 1614 return; | 1618 return; |
| 1615 | 1619 |
| 1616 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 1620 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
| 1617 if (is_loading_) | 1621 if (is_loading_) |
| 1618 cursor = ui::kCursorPointer; | 1622 cursor = ui::kCursorPointer; |
| 1619 | 1623 |
| 1620 aura::client::CursorClient* cursor_client = | 1624 aura::client::CursorClient* cursor_client = |
| 1621 aura::client::GetCursorClient(root_window); | 1625 aura::client::GetCursorClient(root_window); |
| 1622 if (cursor_client) | 1626 if (cursor_client) |
| 1623 cursor_client->SetCursor(cursor); | 1627 cursor_client->SetCursor(cursor); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 RenderWidgetHost* widget) { | 1773 RenderWidgetHost* widget) { |
| 1770 return new RenderWidgetHostViewAura(widget); | 1774 return new RenderWidgetHostViewAura(widget); |
| 1771 } | 1775 } |
| 1772 | 1776 |
| 1773 // static | 1777 // static |
| 1774 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1778 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1775 GetScreenInfoForWindow(results, NULL); | 1779 GetScreenInfoForWindow(results, NULL); |
| 1776 } | 1780 } |
| 1777 | 1781 |
| 1778 } // namespace content | 1782 } // namespace content |
| OLD | NEW |