| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 486 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
| 487 const IPC::Message& message) { | 487 const IPC::Message& message) { |
| 488 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 488 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
| 489 return SyncCompositorOnMessageReceived(message); | 489 return SyncCompositorOnMessageReceived(message); |
| 490 } | 490 } |
| 491 bool handled = true; | 491 bool handled = true; |
| 492 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 492 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
| 493 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) | 493 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) |
| 494 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted, | |
| 495 OnSmartClipDataExtracted) | |
| 496 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 494 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
| 497 OnShowUnhandledTapUIIfNeeded) | 495 OnShowUnhandledTapUIIfNeeded) |
| 498 IPC_MESSAGE_UNHANDLED(handled = false) | 496 IPC_MESSAGE_UNHANDLED(handled = false) |
| 499 IPC_END_MESSAGE_MAP() | 497 IPC_END_MESSAGE_MAP() |
| 500 return handled; | 498 return handled; |
| 501 } | 499 } |
| 502 | 500 |
| 503 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 501 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
| 504 const IPC::Message& message) { | 502 const IPC::Message& message) { |
| 505 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 503 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 else | 851 else |
| 854 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); | 852 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); |
| 855 } | 853 } |
| 856 | 854 |
| 857 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 855 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
| 858 const GURL& content_url, bool is_main_frame) { | 856 const GURL& content_url, bool is_main_frame) { |
| 859 if (content_view_core_) | 857 if (content_view_core_) |
| 860 content_view_core_->StartContentIntent(content_url, is_main_frame); | 858 content_view_core_->StartContentIntent(content_url, is_main_frame); |
| 861 } | 859 } |
| 862 | 860 |
| 863 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | |
| 864 const base::string16& text, | |
| 865 const base::string16& html, | |
| 866 const gfx::Rect rect) { | |
| 867 if (content_view_core_) | |
| 868 content_view_core_->OnSmartClipDataExtracted(text, html, rect); | |
| 869 } | |
| 870 | |
| 871 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 861 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
| 872 const ui::MotionEvent& event) { | 862 const ui::MotionEvent& event) { |
| 873 if (!host_) | 863 if (!host_) |
| 874 return false; | 864 return false; |
| 875 | 865 |
| 876 ComputeEventLatencyOSTouchHistograms(event); | 866 ComputeEventLatencyOSTouchHistograms(event); |
| 877 | 867 |
| 878 // If a browser-based widget consumes the touch event, it's critical that | 868 // If a browser-based widget consumes the touch event, it's critical that |
| 879 // touch event interception be disabled. This avoids issues with | 869 // touch event interception be disabled. This avoids issues with |
| 880 // double-handling for embedder-detected gestures like side swipe. | 870 // double-handling for embedder-detected gestures like side swipe. |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2057 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2068 if (!compositor) | 2058 if (!compositor) |
| 2069 return; | 2059 return; |
| 2070 | 2060 |
| 2071 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2061 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2072 overscroll_refresh_handler, compositor, | 2062 overscroll_refresh_handler, compositor, |
| 2073 ui::GetScaleFactorForNativeView(GetNativeView())); | 2063 ui::GetScaleFactorForNativeView(GetNativeView())); |
| 2074 } | 2064 } |
| 2075 | 2065 |
| 2076 } // namespace content | 2066 } // namespace content |
| OLD | NEW |