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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 517 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
518 const IPC::Message& message) { | 518 const IPC::Message& message) { |
519 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 519 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
520 return SyncCompositorOnMessageReceived(message); | 520 return SyncCompositorOnMessageReceived(message); |
521 } | 521 } |
522 bool handled = true; | 522 bool handled = true; |
523 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 523 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
524 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 524 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
525 OnShowUnhandledTapUIIfNeeded) | 525 OnShowUnhandledTapUIIfNeeded) |
| 526 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectWordAroundCaretAck, |
| 527 OnSelectWordAroundCaretAck) |
526 IPC_MESSAGE_UNHANDLED(handled = false) | 528 IPC_MESSAGE_UNHANDLED(handled = false) |
527 IPC_END_MESSAGE_MAP() | 529 IPC_END_MESSAGE_MAP() |
528 return handled; | 530 return handled; |
529 } | 531 } |
530 | 532 |
531 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 533 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
532 const IPC::Message& message) { | 534 const IPC::Message& message) { |
533 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 535 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
534 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); | 536 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); |
535 } | 537 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 if (!content_view_core_) | 643 if (!content_view_core_) |
642 return; | 644 return; |
643 // Validate the coordinates are within the viewport. | 645 // Validate the coordinates are within the viewport. |
644 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); | 646 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); |
645 if (x_dip < 0 || x_dip > viewport_size.width() || | 647 if (x_dip < 0 || x_dip > viewport_size.width() || |
646 y_dip < 0 || y_dip > viewport_size.height()) | 648 y_dip < 0 || y_dip > viewport_size.height()) |
647 return; | 649 return; |
648 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); | 650 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); |
649 } | 651 } |
650 | 652 |
| 653 void RenderWidgetHostViewAndroid::OnSelectWordAroundCaretAck(bool did_select, |
| 654 int start_adjust, |
| 655 int end_adjust) { |
| 656 if (!content_view_core_) |
| 657 return; |
| 658 content_view_core_->OnSelectWordAroundCaretAck(did_select, start_adjust, |
| 659 end_adjust); |
| 660 } |
| 661 |
651 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 662 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
652 if (!content_view_core_) | 663 if (!content_view_core_) |
653 return default_bounds_; | 664 return default_bounds_; |
654 | 665 |
655 gfx::Size size(content_view_core_->GetViewSize()); | 666 gfx::Size size(content_view_core_->GetViewSize()); |
656 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 667 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
657 switches::kEnableOSKOverscroll)) { | 668 switches::kEnableOSKOverscroll)) { |
658 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); | 669 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); |
659 } | 670 } |
660 | 671 |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 | 2202 |
2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2203 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
2193 if (!compositor) | 2204 if (!compositor) |
2194 return; | 2205 return; |
2195 | 2206 |
2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2207 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2208 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
2198 } | 2209 } |
2199 | 2210 |
2200 } // namespace content | 2211 } // namespace content |
OLD | NEW |