| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 520 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
| 521 const IPC::Message& message) { | 521 const IPC::Message& message) { |
| 522 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { | 522 if (IPC_MESSAGE_ID_CLASS(message.type()) == SyncCompositorMsgStart) { |
| 523 return SyncCompositorOnMessageReceived(message); | 523 return SyncCompositorOnMessageReceived(message); |
| 524 } | 524 } |
| 525 bool handled = true; | 525 bool handled = true; |
| 526 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 526 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
| 527 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, | 527 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowUnhandledTapUIIfNeeded, |
| 528 OnShowUnhandledTapUIIfNeeded) | 528 OnShowUnhandledTapUIIfNeeded) |
| 529 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectWordAroundCaretAck, |
| 530 OnSelectWordAroundCaretAck) |
| 529 IPC_MESSAGE_UNHANDLED(handled = false) | 531 IPC_MESSAGE_UNHANDLED(handled = false) |
| 530 IPC_END_MESSAGE_MAP() | 532 IPC_END_MESSAGE_MAP() |
| 531 return handled; | 533 return handled; |
| 532 } | 534 } |
| 533 | 535 |
| 534 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( | 536 bool RenderWidgetHostViewAndroid::SyncCompositorOnMessageReceived( |
| 535 const IPC::Message& message) { | 537 const IPC::Message& message) { |
| 536 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; | 538 DCHECK(!content_view_core_ || sync_compositor_) << !!content_view_core_; |
| 537 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); | 539 return sync_compositor_ && sync_compositor_->OnMessageReceived(message); |
| 538 } | 540 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 if (!content_view_core_) | 646 if (!content_view_core_) |
| 645 return; | 647 return; |
| 646 // Validate the coordinates are within the viewport. | 648 // Validate the coordinates are within the viewport. |
| 647 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); | 649 gfx::Size viewport_size = content_view_core_->GetViewportSizeDip(); |
| 648 if (x_dip < 0 || x_dip > viewport_size.width() || | 650 if (x_dip < 0 || x_dip > viewport_size.width() || |
| 649 y_dip < 0 || y_dip > viewport_size.height()) | 651 y_dip < 0 || y_dip > viewport_size.height()) |
| 650 return; | 652 return; |
| 651 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); | 653 content_view_core_->OnShowUnhandledTapUIIfNeeded(x_dip, y_dip); |
| 652 } | 654 } |
| 653 | 655 |
| 656 void RenderWidgetHostViewAndroid::OnSelectWordAroundCaretAck(bool did_select, |
| 657 int start_adjust, |
| 658 int end_adjust) { |
| 659 if (!content_view_core_) |
| 660 return; |
| 661 content_view_core_->OnSelectWordAroundCaretAck(did_select, start_adjust, |
| 662 end_adjust); |
| 663 } |
| 664 |
| 654 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 665 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
| 655 if (!content_view_core_) | 666 if (!content_view_core_) |
| 656 return default_bounds_; | 667 return default_bounds_; |
| 657 | 668 |
| 658 gfx::Size size(content_view_core_->GetViewSize()); | 669 gfx::Size size(content_view_core_->GetViewSize()); |
| 659 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 670 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 660 switches::kEnableOSKOverscroll)) { | 671 switches::kEnableOSKOverscroll)) { |
| 661 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); | 672 size.Enlarge(0, view_.GetSystemWindowInsetBottom() / view_.GetDipScale()); |
| 662 } | 673 } |
| 663 | 674 |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 | 2234 |
| 2224 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2235 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2225 if (!compositor) | 2236 if (!compositor) |
| 2226 return; | 2237 return; |
| 2227 | 2238 |
| 2228 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2239 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2229 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2240 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2230 } | 2241 } |
| 2231 | 2242 |
| 2232 } // namespace content | 2243 } // namespace content |
| OLD | NEW |