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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 set_focus_on_mouse_down_or_key_event_(false), | 468 set_focus_on_mouse_down_or_key_event_(false), |
469 device_scale_factor_(0.0f), | 469 device_scale_factor_(0.0f), |
470 disable_input_event_router_for_testing_(false), | 470 disable_input_event_router_for_testing_(false), |
471 weak_ptr_factory_(this) { | 471 weak_ptr_factory_(this) { |
472 if (!is_guest_view_hack_) | 472 if (!is_guest_view_hack_) |
473 host_->SetView(this); | 473 host_->SetView(this); |
474 | 474 |
475 // Let the page-level input event router know about our surface ID | 475 // Let the page-level input event router know about our surface ID |
476 // namespace for surface-based hit testing. | 476 // namespace for surface-based hit testing. |
477 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 477 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
478 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner( | 478 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner( |
479 GetSurfaceIdNamespace(), this); | 479 GetSurfaceClientId(), this); |
480 } | 480 } |
481 | 481 |
482 // We should start observing the TextInputManager for IME-related events as | 482 // We should start observing the TextInputManager for IME-related events as |
483 // well as monitoring its lifetime. | 483 // well as monitoring its lifetime. |
484 if (GetTextInputManager()) | 484 if (GetTextInputManager()) |
485 GetTextInputManager()->AddObserver(this); | 485 GetTextInputManager()->AddObserver(this); |
486 | 486 |
487 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> | 487 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> |
488 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 488 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
489 SetOverscrollControllerEnabled(overscroll_enabled); | 489 SetOverscrollControllerEnabled(overscroll_enabled); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 window_->ReleaseCapture(); | 1987 window_->ReleaseCapture(); |
1988 break; | 1988 break; |
1989 default: | 1989 default: |
1990 break; | 1990 break; |
1991 } | 1991 } |
1992 | 1992 |
1993 if (!IsXButtonUpEvent(event)) | 1993 if (!IsXButtonUpEvent(event)) |
1994 event->SetHandled(); | 1994 event->SetHandled(); |
1995 } | 1995 } |
1996 | 1996 |
1997 uint32_t RenderWidgetHostViewAura::SurfaceIdNamespaceAtPoint( | 1997 uint32_t RenderWidgetHostViewAura::SurfaceClientIdAtPoint( |
1998 cc::SurfaceHittestDelegate* delegate, | 1998 cc::SurfaceHittestDelegate* delegate, |
1999 const gfx::Point& point, | 1999 const gfx::Point& point, |
2000 gfx::Point* transformed_point) { | 2000 gfx::Point* transformed_point) { |
2001 DCHECK(device_scale_factor_ != 0.0f); | 2001 DCHECK(device_scale_factor_ != 0.0f); |
2002 | 2002 |
2003 // The surface hittest happens in device pixels, so we need to convert the | 2003 // The surface hittest happens in device pixels, so we need to convert the |
2004 // |point| from DIPs to pixels before hittesting. | 2004 // |point| from DIPs to pixels before hittesting. |
2005 gfx::Point point_in_pixels = | 2005 gfx::Point point_in_pixels = |
2006 gfx::ConvertPointToPixel(device_scale_factor_, point); | 2006 gfx::ConvertPointToPixel(device_scale_factor_, point); |
2007 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( | 2007 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( |
2008 delegate, point_in_pixels, transformed_point); | 2008 delegate, point_in_pixels, transformed_point); |
2009 *transformed_point = | 2009 *transformed_point = |
2010 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); | 2010 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); |
2011 | 2011 |
2012 // It is possible that the renderer has not yet produced a surface, in which | 2012 // It is possible that the renderer has not yet produced a surface, in which |
2013 // case we return our current namespace. | 2013 // case we return our current namespace. |
2014 if (id.is_null()) | 2014 if (id.is_null()) |
2015 return GetSurfaceIdNamespace(); | 2015 return GetSurfaceClientId(); |
2016 return id.id_namespace(); | 2016 return id.client_id(); |
2017 } | 2017 } |
2018 | 2018 |
2019 void RenderWidgetHostViewAura::ProcessMouseEvent( | 2019 void RenderWidgetHostViewAura::ProcessMouseEvent( |
2020 const blink::WebMouseEvent& event, | 2020 const blink::WebMouseEvent& event, |
2021 const ui::LatencyInfo& latency) { | 2021 const ui::LatencyInfo& latency) { |
2022 host_->ForwardMouseEventWithLatencyInfo(event, latency); | 2022 host_->ForwardMouseEventWithLatencyInfo(event, latency); |
2023 } | 2023 } |
2024 | 2024 |
2025 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 2025 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
2026 const blink::WebMouseWheelEvent& event, | 2026 const blink::WebMouseWheelEvent& event, |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2946 } | 2946 } |
2947 | 2947 |
2948 void RenderWidgetHostViewAura::LockCompositingSurface() { | 2948 void RenderWidgetHostViewAura::LockCompositingSurface() { |
2949 NOTIMPLEMENTED(); | 2949 NOTIMPLEMENTED(); |
2950 } | 2950 } |
2951 | 2951 |
2952 void RenderWidgetHostViewAura::UnlockCompositingSurface() { | 2952 void RenderWidgetHostViewAura::UnlockCompositingSurface() { |
2953 NOTIMPLEMENTED(); | 2953 NOTIMPLEMENTED(); |
2954 } | 2954 } |
2955 | 2955 |
2956 uint32_t RenderWidgetHostViewAura::GetSurfaceIdNamespace() { | 2956 uint32_t RenderWidgetHostViewAura::GetSurfaceClientId() { |
2957 return delegated_frame_host_->GetSurfaceIdNamespace(); | 2957 return delegated_frame_host_->GetSurfaceClientId(); |
2958 } | 2958 } |
2959 | 2959 |
2960 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { | 2960 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { |
2961 return delegated_frame_host_->SurfaceIdForTesting(); | 2961 return delegated_frame_host_->SurfaceIdForTesting(); |
2962 } | 2962 } |
2963 | 2963 |
2964 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( | 2964 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( |
2965 TextInputManager* text_input_manager, | 2965 TextInputManager* text_input_manager, |
2966 RenderWidgetHostViewBase* updated_view, | 2966 RenderWidgetHostViewBase* updated_view, |
2967 bool did_update_state) { | 2967 bool did_update_state) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3001 | 3001 |
3002 //////////////////////////////////////////////////////////////////////////////// | 3002 //////////////////////////////////////////////////////////////////////////////// |
3003 // RenderWidgetHostViewBase, public: | 3003 // RenderWidgetHostViewBase, public: |
3004 | 3004 |
3005 // static | 3005 // static |
3006 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3006 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
3007 GetScreenInfoForWindow(results, NULL); | 3007 GetScreenInfoForWindow(results, NULL); |
3008 } | 3008 } |
3009 | 3009 |
3010 } // namespace content | 3010 } // namespace content |
OLD | NEW |