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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 477 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
478 const IPC::Message& message) { | 478 const IPC::Message& message) { |
479 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 479 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
480 return SyncCompositorOnMessageReceived(message); | 480 return SyncCompositorOnMessageReceived(message); |
481 } | 481 } |
482 bool handled = true; | 482 bool handled = true; |
483 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 483 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
484 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) | 484 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) |
485 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted, | |
486 OnSmartClipDataExtracted) | |
487 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 485 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
488 OnShowUnhandledTapUIIfNeeded) | 486 OnShowUnhandledTapUIIfNeeded) |
489 IPC_MESSAGE_UNHANDLED(handled = false) | 487 IPC_MESSAGE_UNHANDLED(handled = false) |
490 IPC_END_MESSAGE_MAP() | 488 IPC_END_MESSAGE_MAP() |
491 return handled; | 489 return handled; |
492 } | 490 } |
493 | 491 |
494 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 492 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
495 const IPC::Message& message) { | 493 const IPC::Message& message) { |
496 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 494 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 else | 802 else |
805 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); | 803 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); |
806 } | 804 } |
807 | 805 |
808 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 806 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
809 const GURL& content_url, bool is_main_frame) { | 807 const GURL& content_url, bool is_main_frame) { |
810 if (content_view_core_) | 808 if (content_view_core_) |
811 content_view_core_->StartContentIntent(content_url, is_main_frame); | 809 content_view_core_->StartContentIntent(content_url, is_main_frame); |
812 } | 810 } |
813 | 811 |
814 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | |
815 const base::string16& text, | |
816 const base::string16& html, | |
817 const gfx::Rect rect) { | |
818 if (content_view_core_) | |
819 content_view_core_->OnSmartClipDataExtracted(text, html, rect); | |
820 } | |
821 | |
822 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 812 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
823 const ui::MotionEvent& event) { | 813 const ui::MotionEvent& event) { |
824 if (!host_) | 814 if (!host_) |
825 return false; | 815 return false; |
826 | 816 |
827 ComputeEventLatencyOSTouchHistograms(event); | 817 ComputeEventLatencyOSTouchHistograms(event); |
828 | 818 |
829 // If a browser-based widget consumes the touch event, it's critical that | 819 // If a browser-based widget consumes the touch event, it's critical that |
830 // touch event interception be disabled. This avoids issues with | 820 // touch event interception be disabled. This avoids issues with |
831 // double-handling for embedder-detected gestures like side swipe. | 821 // double-handling for embedder-detected gestures like side swipe. |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 1976 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
1987 if (!compositor) | 1977 if (!compositor) |
1988 return; | 1978 return; |
1989 | 1979 |
1990 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 1980 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
1991 overscroll_refresh_handler, compositor, | 1981 overscroll_refresh_handler, compositor, |
1992 ui::GetScaleFactorForNativeView(GetNativeView())); | 1982 ui::GetScaleFactorForNativeView(GetNativeView())); |
1993 } | 1983 } |
1994 | 1984 |
1995 } // namespace content | 1985 } // namespace content |
OLD | NEW |