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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ShowUnhandledTapUIIfNeeded, | 485 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
486 OnShowUnhandledTapUIIfNeeded) | 486 OnShowUnhandledTapUIIfNeeded) |
| 487 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectWordAroundCaretAck, |
| 488 OnSelectWordAroundCaretAck) |
487 IPC_MESSAGE_UNHANDLED(handled = false) | 489 IPC_MESSAGE_UNHANDLED(handled = false) |
488 IPC_END_MESSAGE_MAP() | 490 IPC_END_MESSAGE_MAP() |
489 return handled; | 491 return handled; |
490 } | 492 } |
491 | 493 |
492 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 494 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
493 const IPC::Message& message) { | 495 const IPC::Message& message) { |
494 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 496 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
495 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); | 497 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); |
496 } | 498 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (!content_view_core_) | 633 if (!content_view_core_) |
632 return; | 634 return; |
633 // Validate the coordinates are within the viewport. | 635 // Validate the coordinates are within the viewport. |
634 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); | 636 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); |
635 if (x_dip < 0 || x_dip > viewport_size.width() || | 637 if (x_dip < 0 || x_dip > viewport_size.width() || |
636 y_dip < 0 || y_dip > viewport_size.height()) | 638 y_dip < 0 || y_dip > viewport_size.height()) |
637 return; | 639 return; |
638 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); | 640 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); |
639 } | 641 } |
640 | 642 |
| 643 void RenderWidgetHostViewAndroid::OnSelectWordAroundCaretAck(bool did_select, |
| 644 int start_adjust, |
| 645 int end_adjust) { |
| 646 if (!content_view_core_) |
| 647 return; |
| 648 content_view_core_->OnSelectWordAroundCaretAck(did_select, start_adjust, |
| 649 end_adjust); |
| 650 } |
| 651 |
641 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 652 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
642 if (!content_view_core_) | 653 if (!content_view_core_) |
643 return default_bounds_; | 654 return default_bounds_; |
644 | 655 |
645 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 656 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
646 switches::kEnableOSKOverscroll)) | 657 switches::kEnableOSKOverscroll)) |
647 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden()); | 658 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden()); |
648 | 659 |
649 return gfx::Rect(content_view_core_->GetViewSize()); | 660 return gfx::Rect(content_view_core_->GetViewSize()); |
650 } | 661 } |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 1985 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
1975 if (!compositor) | 1986 if (!compositor) |
1976 return; | 1987 return; |
1977 | 1988 |
1978 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 1989 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
1979 overscroll_refresh_handler, compositor, | 1990 overscroll_refresh_handler, compositor, |
1980 ui::GetScaleFactorForNativeView(GetNativeView())); | 1991 ui::GetScaleFactorForNativeView(GetNativeView())); |
1981 } | 1992 } |
1982 | 1993 |
1983 } // namespace content | 1994 } // namespace content |
OLD | NEW |