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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 disable_input_event_router_for_testing_(false), | 457 disable_input_event_router_for_testing_(false), |
458 last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID), | 458 last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID), |
459 last_active_widget_routing_id_(MSG_ROUTING_NONE), | 459 last_active_widget_routing_id_(MSG_ROUTING_NONE), |
460 weak_ptr_factory_(this) { | 460 weak_ptr_factory_(this) { |
461 if (!is_guest_view_hack_) | 461 if (!is_guest_view_hack_) |
462 host_->SetView(this); | 462 host_->SetView(this); |
463 | 463 |
464 // Let the page-level input event router know about our surface ID | 464 // Let the page-level input event router know about our surface ID |
465 // namespace for surface-based hit testing. | 465 // namespace for surface-based hit testing. |
466 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { | 466 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { |
467 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner( | 467 host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( |
468 GetSurfaceClientId(), this); | 468 GetFrameSinkId(), this); |
469 } | 469 } |
470 | 470 |
471 // We should start observing the TextInputManager for IME-related events as | 471 // We should start observing the TextInputManager for IME-related events as |
472 // well as monitoring its lifetime. | 472 // well as monitoring its lifetime. |
473 if (GetTextInputManager()) | 473 if (GetTextInputManager()) |
474 GetTextInputManager()->AddObserver(this); | 474 GetTextInputManager()->AddObserver(this); |
475 | 475 |
476 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> | 476 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> |
477 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 477 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
478 SetOverscrollControllerEnabled(overscroll_enabled); | 478 SetOverscrollControllerEnabled(overscroll_enabled); |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 window_->ReleaseCapture(); | 1999 window_->ReleaseCapture(); |
2000 break; | 2000 break; |
2001 default: | 2001 default: |
2002 break; | 2002 break; |
2003 } | 2003 } |
2004 | 2004 |
2005 if (!IsXButtonUpEvent(event)) | 2005 if (!IsXButtonUpEvent(event)) |
2006 event->SetHandled(); | 2006 event->SetHandled(); |
2007 } | 2007 } |
2008 | 2008 |
2009 uint32_t RenderWidgetHostViewAura::SurfaceClientIdAtPoint( | 2009 cc::FrameSinkId RenderWidgetHostViewAura::FrameSinkIdAtPoint( |
2010 cc::SurfaceHittestDelegate* delegate, | 2010 cc::SurfaceHittestDelegate* delegate, |
2011 const gfx::Point& point, | 2011 const gfx::Point& point, |
2012 gfx::Point* transformed_point) { | 2012 gfx::Point* transformed_point) { |
2013 DCHECK(device_scale_factor_ != 0.0f); | 2013 DCHECK(device_scale_factor_ != 0.0f); |
2014 | 2014 |
2015 // The surface hittest happens in device pixels, so we need to convert the | 2015 // The surface hittest happens in device pixels, so we need to convert the |
2016 // |point| from DIPs to pixels before hittesting. | 2016 // |point| from DIPs to pixels before hittesting. |
2017 gfx::Point point_in_pixels = | 2017 gfx::Point point_in_pixels = |
2018 gfx::ConvertPointToPixel(device_scale_factor_, point); | 2018 gfx::ConvertPointToPixel(device_scale_factor_, point); |
2019 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( | 2019 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( |
2020 delegate, point_in_pixels, transformed_point); | 2020 delegate, point_in_pixels, transformed_point); |
2021 *transformed_point = | 2021 *transformed_point = |
2022 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); | 2022 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point); |
2023 | 2023 |
2024 // It is possible that the renderer has not yet produced a surface, in which | 2024 // It is possible that the renderer has not yet produced a surface, in which |
2025 // case we return our current namespace. | 2025 // case we return our current namespace. |
2026 if (id.is_null()) | 2026 if (id.is_null()) |
2027 return GetSurfaceClientId(); | 2027 return GetFrameSinkId(); |
2028 return id.client_id(); | 2028 return id.frame_sink_id(); |
2029 } | 2029 } |
2030 | 2030 |
2031 void RenderWidgetHostViewAura::ProcessMouseEvent( | 2031 void RenderWidgetHostViewAura::ProcessMouseEvent( |
2032 const blink::WebMouseEvent& event, | 2032 const blink::WebMouseEvent& event, |
2033 const ui::LatencyInfo& latency) { | 2033 const ui::LatencyInfo& latency) { |
2034 host_->ForwardMouseEventWithLatencyInfo(event, latency); | 2034 host_->ForwardMouseEventWithLatencyInfo(event, latency); |
2035 } | 2035 } |
2036 | 2036 |
2037 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( | 2037 void RenderWidgetHostViewAura::ProcessMouseWheelEvent( |
2038 const blink::WebMouseWheelEvent& event, | 2038 const blink::WebMouseWheelEvent& event, |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 } | 2962 } |
2963 | 2963 |
2964 void RenderWidgetHostViewAura::LockCompositingSurface() { | 2964 void RenderWidgetHostViewAura::LockCompositingSurface() { |
2965 NOTIMPLEMENTED(); | 2965 NOTIMPLEMENTED(); |
2966 } | 2966 } |
2967 | 2967 |
2968 void RenderWidgetHostViewAura::UnlockCompositingSurface() { | 2968 void RenderWidgetHostViewAura::UnlockCompositingSurface() { |
2969 NOTIMPLEMENTED(); | 2969 NOTIMPLEMENTED(); |
2970 } | 2970 } |
2971 | 2971 |
2972 uint32_t RenderWidgetHostViewAura::GetSurfaceClientId() { | 2972 cc::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() { |
2973 return delegated_frame_host_->GetSurfaceClientId(); | 2973 return delegated_frame_host_->GetFrameSinkId(); |
2974 } | 2974 } |
2975 | 2975 |
2976 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { | 2976 cc::SurfaceId RenderWidgetHostViewAura::SurfaceIdForTesting() const { |
2977 return delegated_frame_host_->SurfaceIdForTesting(); | 2977 return delegated_frame_host_->SurfaceIdForTesting(); |
2978 } | 2978 } |
2979 | 2979 |
2980 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( | 2980 void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled( |
2981 TextInputManager* text_input_manager, | 2981 TextInputManager* text_input_manager, |
2982 RenderWidgetHostViewBase* updated_view, | 2982 RenderWidgetHostViewBase* updated_view, |
2983 bool did_update_state) { | 2983 bool did_update_state) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3063 ->GetTextSelection(focused_view) | 3063 ->GetTextSelection(focused_view) |
3064 ->GetSelectedText(&selected_text)) { | 3064 ->GetSelectedText(&selected_text)) { |
3065 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3065 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
3066 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3066 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
3067 clipboard_writer.WriteText(selected_text); | 3067 clipboard_writer.WriteText(selected_text); |
3068 } | 3068 } |
3069 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3069 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
3070 } | 3070 } |
3071 | 3071 |
3072 } // namespace content | 3072 } // namespace content |
OLD | NEW |