| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 disable_input_event_router_for_testing_(false), | 454 disable_input_event_router_for_testing_(false), |
| 455 last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID), | 455 last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID), |
| 456 last_active_widget_routing_id_(MSG_ROUTING_NONE), | 456 last_active_widget_routing_id_(MSG_ROUTING_NONE), |
| 457 weak_ptr_factory_(this) { | 457 weak_ptr_factory_(this) { |
| 458 if (!is_guest_view_hack_) | 458 if (!is_guest_view_hack_) |
| 459 host_->SetView(this); | 459 host_->SetView(this); |
| 460 | 460 |
| 461 // Let the page-level input event router know about our surface ID | 461 // Let the page-level input event router know about our surface ID |
| 462 // namespace for surface-based hit testing. | 462 // namespace for surface-based hit testing. |
| 463 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 463 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
| 464 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner( | 464 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( |
| 465 GetSurfaceClientId(), this); | 465 GetFrameSinkId(), this); |
| 466 } | 466 } |
| 467 | 467 |
| 468 // We should start observing the TextInputManager for IME-related events as | 468 // We should start observing the TextInputManager for IME-related events as |
| 469 // well as monitoring its lifetime. | 469 // well as monitoring its lifetime. |
| 470 if (GetTextInputManager()) | 470 if (GetTextInputManager()) |
| 471 GetTextInputManager()->AddObserver(this); | 471 GetTextInputManager()->AddObserver(this); |
| 472 | 472 |
| 473 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> | 473 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> |
| 474 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 474 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
| 475 SetOverscrollControllerEnabled(overscroll_enabled); | 475 SetOverscrollControllerEnabled(overscroll_enabled); |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 window_->ReleaseCapture(); | 1978 window_->ReleaseCapture(); |
| 1979 break; | 1979 break; |
| 1980 default: | 1980 default: |
| 1981 break; | 1981 break; |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 if (!IsXButtonUpEvent(event)) | 1984 if (!IsXButtonUpEvent(event)) |
| 1985 event->SetHandled(); | 1985 event->SetHandled(); |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 uint32_t RenderWidgetHostViewAura::SurfaceClientIdAtPoint( | 1988 cc::FrameSinkId RenderWidgetHostViewAura::FrameSinkIdAtPoint( |
| 1989 cc::SurfaceHittestDelegate* delegate, | 1989 cc::SurfaceHittestDelegate* delegate, |
| 1990 const gfx::Point& point, | 1990 const gfx::Point& point, |
| 1991 gfx::Point* transformed_point) { | 1991 gfx::Point* transformed_point) { |
| 1992 DCHECK(device_scale_factor_ != 0.0f); | 1992 DCHECK(device_scale_factor_ != 0.0f); |
| 1993 | 1993 |
| 1994 // The surface hittest happens in device pixels, so we need to convert the | 1994 // The surface hittest happens in device pixels, so we need to convert the |
| 1995 // |point| from DIPs to pixels before hittesting. | 1995 // |point| from DIPs to pixels before hittesting. |
| 1996 gfx::Point point_in_pixels = | 1996 gfx::Point point_in_pixels = |
| 1997 gfx::ConvertPointToPixel(device_scale_factor_, point); | 1997 gfx::ConvertPointToPixel(device_scale_factor_, point); |
| 1998 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( | 1998 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( |
| 1999 delegate, point_in_pixels, transformed_point); | 1999 delegate, point_in_pixels, transformed_point); |
| 2000 *transformed_point = | 2000 *transformed_point = |
| 2001 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); | 2001 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); |
| 2002 | 2002 |
| 2003 // It is possible that the renderer has not yet produced a surface, in which | 2003 // It is possible that the renderer has not yet produced a surface, in which |
| 2004 // case we return our current namespace. | 2004 // case we return our current namespace. |
| 2005 if (id.is_null()) | 2005 if (id.is_null()) |
| 2006 return GetSurfaceClientId(); | 2006 return GetFrameSinkId(); |
| 2007 return id.client_id(); | 2007 return id.frame_sink_id(); |
| 2008 } | 2008 } |
| 2009 | 2009 |
| 2010 void RenderWidgetHostViewAura::ProcessMouseEvent( | 2010 void RenderWidgetHostViewAura::ProcessMouseEvent( |
| 2011 const blink::WebMouseEvent& event, | 2011 const blink::WebMouseEvent& event, |
| 2012 const ui::LatencyInfo& latency) { | 2012 const ui::LatencyInfo& latency) { |
| 2013 host_->ForwardMouseEventWithLatencyInfo(event, latency); | 2013 host_->ForwardMouseEventWithLatencyInfo(event, latency); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 2016 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
| 2017 const blink::WebMouseWheelEvent& event, | 2017 const blink::WebMouseWheelEvent& event, |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 } | 2939 } |
| 2940 | 2940 |
| 2941 void RenderWidgetHostViewAura::LockCompositingSurface() { | 2941 void RenderWidgetHostViewAura::LockCompositingSurface() { |
| 2942 NOTIMPLEMENTED(); | 2942 NOTIMPLEMENTED(); |
| 2943 } | 2943 } |
| 2944 | 2944 |
| 2945 void RenderWidgetHostViewAura::UnlockCompositingSurface() { | 2945 void RenderWidgetHostViewAura::UnlockCompositingSurface() { |
| 2946 NOTIMPLEMENTED(); | 2946 NOTIMPLEMENTED(); |
| 2947 } | 2947 } |
| 2948 | 2948 |
| 2949 uint32_t RenderWidgetHostViewAura::GetSurfaceClientId() { | 2949 cc::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() { |
| 2950 return delegated_frame_host_->GetSurfaceClientId(); | 2950 return delegated_frame_host_->GetFrameSinkId(); |
| 2951 } | 2951 } |
| 2952 | 2952 |
| 2953 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { | 2953 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { |
| 2954 return delegated_frame_host_->SurfaceIdForTesting(); | 2954 return delegated_frame_host_->SurfaceIdForTesting(); |
| 2955 } | 2955 } |
| 2956 | 2956 |
| 2957 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( | 2957 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( |
| 2958 TextInputManager* text_input_manager, | 2958 TextInputManager* text_input_manager, |
| 2959 RenderWidgetHostViewBase* updated_view, | 2959 RenderWidgetHostViewBase* updated_view, |
| 2960 bool did_update_state) { | 2960 bool did_update_state) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 ->GetTextSelection(focused_view) | 3040 ->GetTextSelection(focused_view) |
| 3041 ->GetSelectedText(&selected_text)) { | 3041 ->GetSelectedText(&selected_text)) { |
| 3042 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3042 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3043 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3043 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3044 clipboard_writer.WriteText(selected_text); | 3044 clipboard_writer.WriteText(selected_text); |
| 3045 } | 3045 } |
| 3046 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3046 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3047 } | 3047 } |
| 3048 | 3048 |
| 3049 } // namespace content | 3049 } // namespace content |
| OLD | NEW |