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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 515 |
516 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 516 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
517 const IPC::Message& message) { | 517 const IPC::Message& message) { |
518 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 518 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
519 return SyncCompositorOnMessageReceived(message); | 519 return SyncCompositorOnMessageReceived(message); |
520 } | 520 } |
521 bool handled = true; | 521 bool handled = true; |
522 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 522 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
523 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 523 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
524 OnShowUnhandledTapUIIfNeeded) | 524 OnShowUnhandledTapUIIfNeeded) |
| 525 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectWordAroundCaretAck, |
| 526 OnSelectWordAroundCaretAck) |
525 IPC_MESSAGE_UNHANDLED(handled = false) | 527 IPC_MESSAGE_UNHANDLED(handled = false) |
526 IPC_END_MESSAGE_MAP() | 528 IPC_END_MESSAGE_MAP() |
527 return handled; | 529 return handled; |
528 } | 530 } |
529 | 531 |
530 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 532 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
531 const IPC::Message& message) { | 533 const IPC::Message& message) { |
532 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 534 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
533 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); | 535 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); |
534 } | 536 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 if (!content_view_core_) | 642 if (!content_view_core_) |
641 return; | 643 return; |
642 // Validate the coordinates are within the viewport. | 644 // Validate the coordinates are within the viewport. |
643 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); | 645 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); |
644 if (x_dip < 0 || x_dip > viewport_size.width() || | 646 if (x_dip < 0 || x_dip > viewport_size.width() || |
645 y_dip < 0 || y_dip > viewport_size.height()) | 647 y_dip < 0 || y_dip > viewport_size.height()) |
646 return; | 648 return; |
647 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); | 649 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); |
648 } | 650 } |
649 | 651 |
| 652 void RenderWidgetHostViewAndroid::OnSelectWordAroundCaretAck(bool did_select, |
| 653 int start_adjust, |
| 654 int end_adjust) { |
| 655 if (!content_view_core_) |
| 656 return; |
| 657 content_view_core_->OnSelectWordAroundCaretAck(did_select, start_adjust, |
| 658 end_adjust); |
| 659 } |
| 660 |
650 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 661 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
651 if (!content_view_core_) | 662 if (!content_view_core_) |
652 return default_bounds_; | 663 return default_bounds_; |
653 | 664 |
654 gfx::Size size(content_view_core_->GetViewSize()); | 665 gfx::Size size(content_view_core_->GetViewSize()); |
655 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 666 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
656 switches::kEnableOSKOverscroll)) { | 667 switches::kEnableOSKOverscroll)) { |
657 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); | 668 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); |
658 } | 669 } |
659 | 670 |
(...skipping 1531 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 |