Chromium Code Reviews| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 #include "content/public/browser/devtools_agent_host.h" | 69 #include "content/public/browser/devtools_agent_host.h" |
| 70 #include "content/public/browser/render_view_host.h" | 70 #include "content/public/browser/render_view_host.h" |
| 71 #include "content/public/browser/render_widget_host_iterator.h" | 71 #include "content/public/browser/render_widget_host_iterator.h" |
| 72 #include "content/public/common/content_switches.h" | 72 #include "content/public/common/content_switches.h" |
| 73 #include "gpu/command_buffer/client/gles2_implementation.h" | 73 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 74 #include "gpu/command_buffer/client/gles2_interface.h" | 74 #include "gpu/command_buffer/client/gles2_interface.h" |
| 75 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 75 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 76 #include "ipc/ipc_message_macros.h" | 76 #include "ipc/ipc_message_macros.h" |
| 77 #include "ipc/ipc_message_start.h" | 77 #include "ipc/ipc_message_start.h" |
| 78 #include "skia/ext/image_operations.h" | 78 #include "skia/ext/image_operations.h" |
| 79 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | |
| 79 #include "third_party/khronos/GLES2/gl2.h" | 80 #include "third_party/khronos/GLES2/gl2.h" |
| 80 #include "third_party/khronos/GLES2/gl2ext.h" | 81 #include "third_party/khronos/GLES2/gl2ext.h" |
| 81 #include "third_party/skia/include/core/SkCanvas.h" | 82 #include "third_party/skia/include/core/SkCanvas.h" |
| 83 #include "ui/android/cursor_type.h" | |
| 82 #include "ui/android/window_android.h" | 84 #include "ui/android/window_android.h" |
| 83 #include "ui/android/window_android_compositor.h" | 85 #include "ui/android/window_android_compositor.h" |
| 84 #include "ui/base/layout.h" | 86 #include "ui/base/layout.h" |
| 85 #include "ui/events/android/motion_event_android.h" | 87 #include "ui/events/android/motion_event_android.h" |
| 86 #include "ui/events/base_event_utils.h" | 88 #include "ui/events/base_event_utils.h" |
| 87 #include "ui/events/blink/blink_event_util.h" | 89 #include "ui/events/blink/blink_event_util.h" |
| 88 #include "ui/events/blink/did_overscroll_params.h" | 90 #include "ui/events/blink/did_overscroll_params.h" |
| 89 #include "ui/events/blink/web_input_event_traits.h" | 91 #include "ui/events/blink/web_input_event_traits.h" |
| 90 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 92 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| 91 #include "ui/gfx/android/java_bitmap.h" | 93 #include "ui/gfx/android/java_bitmap.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 115 friend class base::RefCounted<PendingReadbackLock>; | 117 friend class base::RefCounted<PendingReadbackLock>; |
| 116 | 118 |
| 117 ~PendingReadbackLock() { | 119 ~PendingReadbackLock() { |
| 118 DCHECK_EQ(g_pending_readback_lock, this); | 120 DCHECK_EQ(g_pending_readback_lock, this); |
| 119 g_pending_readback_lock = nullptr; | 121 g_pending_readback_lock = nullptr; |
| 120 } | 122 } |
| 121 }; | 123 }; |
| 122 | 124 |
| 123 using base::android::ApplicationState; | 125 using base::android::ApplicationState; |
| 124 using base::android::ApplicationStatusListener; | 126 using base::android::ApplicationStatusListener; |
| 127 using blink::WebCursorInfo; | |
| 128 using ui::CursorType; | |
| 125 | 129 |
| 126 class GLHelperHolder { | 130 class GLHelperHolder { |
| 127 public: | 131 public: |
| 128 static GLHelperHolder* Create(); | 132 static GLHelperHolder* Create(); |
| 129 | 133 |
| 130 display_compositor::GLHelper* gl_helper() { return gl_helper_.get(); } | 134 display_compositor::GLHelper* gl_helper() { return gl_helper_.get(); } |
| 131 bool IsLost() { | 135 bool IsLost() { |
| 132 if (!gl_helper_) | 136 if (!gl_helper_) |
| 133 return true; | 137 return true; |
| 134 return provider_->ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 138 return provider_->ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 | 700 |
| 697 float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const { | 701 float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const { |
| 698 if (!content_view_core_) | 702 if (!content_view_core_) |
| 699 return 0.f; | 703 return 0.f; |
| 700 | 704 |
| 701 // The height of the browser controls. | 705 // The height of the browser controls. |
| 702 return content_view_core_->GetBottomControlsHeightDip(); | 706 return content_view_core_->GetBottomControlsHeightDip(); |
| 703 } | 707 } |
| 704 | 708 |
| 705 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { | 709 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { |
| 706 // There are no cursors on Android. | 710 if (!content_view_core_) |
|
aelias_OOO_until_Jul13
2017/05/17 04:47:15
No longer needed.
Jinsuk Kim
2017/05/17 04:49:50
No need to do this check.
jaebaek
2017/05/18 01:44:28
Done.
jaebaek
2017/05/18 01:44:28
Done.
| |
| 711 return; | |
| 712 | |
| 713 CursorInfo cursor_info; | |
| 714 cursor.GetCursorInfo(&cursor_info); | |
| 715 CursorType cursor_type; | |
| 716 switch (cursor_info.type) { | |
| 717 case WebCursorInfo::kTypeCustom: | |
| 718 cursor_type = CursorType::CURSOR_TYPE_CUSTOM; | |
| 719 break; | |
| 720 case WebCursorInfo::kTypeNone: | |
| 721 cursor_type = CursorType::CURSOR_TYPE_NULL; | |
| 722 break; | |
| 723 case WebCursorInfo::kTypePointer: | |
| 724 cursor_type = CursorType::CURSOR_TYPE_ARROW; | |
| 725 break; | |
| 726 case WebCursorInfo::kTypeContextMenu: | |
| 727 cursor_type = CursorType::CURSOR_TYPE_CONTEXT_MENU; | |
| 728 break; | |
| 729 case WebCursorInfo::kTypeHand: | |
| 730 cursor_type = CursorType::CURSOR_TYPE_HAND; | |
| 731 break; | |
| 732 case WebCursorInfo::kTypeHelp: | |
| 733 cursor_type = CursorType::CURSOR_TYPE_HELP; | |
| 734 break; | |
| 735 case WebCursorInfo::kTypeWait: | |
| 736 cursor_type = CursorType::CURSOR_TYPE_WAIT; | |
| 737 break; | |
| 738 case WebCursorInfo::kTypeCell: | |
| 739 cursor_type = CursorType::CURSOR_TYPE_CELL; | |
| 740 break; | |
| 741 case WebCursorInfo::kTypeCross: | |
| 742 cursor_type = CursorType::CURSOR_TYPE_CROSSHAIR; | |
| 743 break; | |
| 744 case WebCursorInfo::kTypeIBeam: | |
| 745 cursor_type = CursorType::CURSOR_TYPE_TEXT; | |
| 746 break; | |
| 747 case WebCursorInfo::kTypeVerticalText: | |
| 748 cursor_type = CursorType::CURSOR_TYPE_VERTICAL_TEXT; | |
| 749 break; | |
| 750 case WebCursorInfo::kTypeAlias: | |
| 751 cursor_type = CursorType::CURSOR_TYPE_ALIAS; | |
| 752 break; | |
| 753 case WebCursorInfo::kTypeCopy: | |
| 754 cursor_type = CursorType::CURSOR_TYPE_COPY; | |
| 755 break; | |
| 756 case WebCursorInfo::kTypeNoDrop: | |
| 757 cursor_type = CursorType::CURSOR_TYPE_NO_DROP; | |
| 758 break; | |
| 759 case WebCursorInfo::kTypeEastWestResize: | |
| 760 case WebCursorInfo::kTypeColumnResize: | |
| 761 cursor_type = CursorType::CURSOR_TYPE_HORIZONTAL_DOUBLE_ARROW; | |
| 762 break; | |
| 763 case WebCursorInfo::kTypeNorthSouthResize: | |
| 764 case WebCursorInfo::kTypeRowResize: | |
| 765 cursor_type = CursorType::CURSOR_TYPE_VERTICAL_DOUBLE_ARROW; | |
| 766 break; | |
| 767 case WebCursorInfo::kTypeNorthEastSouthWestResize: | |
| 768 cursor_type = CursorType::CURSOR_TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; | |
| 769 break; | |
| 770 case WebCursorInfo::kTypeNorthWestSouthEastResize: | |
| 771 cursor_type = CursorType::CURSOR_TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; | |
| 772 break; | |
| 773 case WebCursorInfo::kTypeZoomIn: | |
| 774 cursor_type = CursorType::CURSOR_TYPE_ZOOM_IN; | |
| 775 break; | |
| 776 case WebCursorInfo::kTypeZoomOut: | |
| 777 cursor_type = CursorType::CURSOR_TYPE_ZOOM_OUT; | |
| 778 break; | |
| 779 case WebCursorInfo::kTypeGrab: | |
| 780 cursor_type = CursorType::CURSOR_TYPE_GRAB; | |
| 781 break; | |
| 782 case WebCursorInfo::kTypeGrabbing: | |
| 783 cursor_type = CursorType::CURSOR_TYPE_GRABBING; | |
| 784 break; | |
| 785 default: | |
| 786 LOG(WARNING) << "Invalid cursor type: " | |
|
aelias_OOO_until_Jul13
2017/05/17 04:47:15
This is likely to spam logs and the problem is not
jaebaek
2017/05/18 01:44:28
Done.
| |
| 787 << WebCursorInfo::GetName(cursor_info.type) << " (" | |
| 788 << cursor_info.type << ")"; | |
| 789 cursor_type = CursorType::CURSOR_TYPE_ARROW; | |
| 790 break; | |
| 791 } | |
| 792 view_.OnCursorChanged(cursor_type, cursor_info.custom_image, | |
| 793 cursor_info.hotspot); | |
| 707 } | 794 } |
| 708 | 795 |
| 709 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 796 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
| 710 // Do nothing. The UI notification is handled through ContentViewClient which | 797 // Do nothing. The UI notification is handled through ContentViewClient which |
| 711 // is TabContentsDelegate. | 798 // is TabContentsDelegate. |
| 712 } | 799 } |
| 713 | 800 |
| 714 // ----------------------------------------------------------------------------- | 801 // ----------------------------------------------------------------------------- |
| 715 // TextInputManager::Observer implementations. | 802 // TextInputManager::Observer implementations. |
| 716 void RenderWidgetHostViewAndroid::OnUpdateTextInputStateCalled( | 803 void RenderWidgetHostViewAndroid::OnUpdateTextInputStateCalled( |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2191 | 2278 |
| 2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2279 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2193 if (!compositor) | 2280 if (!compositor) |
| 2194 return; | 2281 return; |
| 2195 | 2282 |
| 2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2283 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2284 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2198 } | 2285 } |
| 2199 | 2286 |
| 2200 } // namespace content | 2287 } // namespace content |
| OLD | NEW |