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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <queue> | 13 #include <queue> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/process/process.h" | 20 #include "base/process/process.h" |
21 #include "cc/input/selection.h" | 21 #include "cc/input/selection.h" |
22 #include "cc/output/begin_frame_args.h" | 22 #include "cc/output/begin_frame_args.h" |
23 #include "cc/scheduler/begin_frame_source.h" | 23 #include "cc/scheduler/begin_frame_source.h" |
24 #include "content/browser/accessibility/browser_accessibility_manager.h" | 24 #include "content/browser/accessibility/browser_accessibility_manager.h" |
25 #include "content/browser/android/content_view_core_impl_observer.h" | 25 #include "content/browser/android/content_view_core_impl_observer.h" |
26 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 26 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
| 27 #include "content/browser/renderer_host/ime_adapter_android.h" |
27 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 28 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
29 #include "content/browser/renderer_host/text_input_manager.h" | 30 #include "content/browser/renderer_host/text_input_manager.h" |
30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
31 #include "content/public/browser/readback_types.h" | 32 #include "content/public/browser/readback_types.h" |
32 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
33 #include "third_party/skia/include/core/SkColor.h" | 34 #include "third_party/skia/include/core/SkColor.h" |
34 #include "ui/android/delegated_frame_host_android.h" | 35 #include "ui/android/delegated_frame_host_android.h" |
35 #include "ui/android/view_android.h" | 36 #include "ui/android/view_android.h" |
36 #include "ui/android/view_client.h" | 37 #include "ui/android/view_client.h" |
37 #include "ui/android/window_android_observer.h" | 38 #include "ui/android/window_android_observer.h" |
38 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 39 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
39 #include "ui/gfx/geometry/size.h" | 40 #include "ui/gfx/geometry/size.h" |
40 #include "ui/gfx/geometry/vector2d_f.h" | 41 #include "ui/gfx/geometry/vector2d_f.h" |
41 #include "ui/gfx/selection_bound.h" | 42 #include "ui/gfx/selection_bound.h" |
42 #include "ui/touch_selection/touch_selection_controller.h" | 43 #include "ui/touch_selection/touch_selection_controller.h" |
43 | 44 |
44 namespace ui { | 45 namespace ui { |
45 class MotionEventAndroid; | 46 class MotionEventAndroid; |
46 struct DidOverscrollParams; | 47 struct DidOverscrollParams; |
47 } | 48 } |
48 | 49 |
49 namespace content { | 50 namespace content { |
50 class ContentViewCoreImpl; | 51 class ContentViewCoreImpl; |
51 class ImeAdapterAndroid; | |
52 class OverscrollControllerAndroid; | 52 class OverscrollControllerAndroid; |
53 class RenderWidgetHost; | 53 class RenderWidgetHost; |
54 class RenderWidgetHostImpl; | 54 class RenderWidgetHostImpl; |
55 class SynchronousCompositorHost; | 55 class SynchronousCompositorHost; |
56 class SynchronousCompositorClient; | 56 class SynchronousCompositorClient; |
57 struct NativeWebKeyboardEvent; | 57 struct NativeWebKeyboardEvent; |
58 | 58 |
59 // ----------------------------------------------------------------------------- | 59 // ----------------------------------------------------------------------------- |
60 // See comments in render_widget_host_view.h about this class and its members. | 60 // See comments in render_widget_host_view.h about this class and its members. |
61 // ----------------------------------------------------------------------------- | 61 // ----------------------------------------------------------------------------- |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Non-virtual methods | 221 // Non-virtual methods |
222 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 222 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
223 SkColor GetCachedBackgroundColor() const; | 223 SkColor GetCachedBackgroundColor() const; |
224 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 224 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
225 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); | 225 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); |
226 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 226 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
227 void SendGestureEvent(const blink::WebGestureEvent& event); | 227 void SendGestureEvent(const blink::WebGestureEvent& event); |
228 void ResolveTapDisambiguation(double timestamp_seconds, | 228 void ResolveTapDisambiguation(double timestamp_seconds, |
229 gfx::Point tap_viewport_offset, | 229 gfx::Point tap_viewport_offset, |
230 bool is_long_press); | 230 bool is_long_press); |
231 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { | |
232 ime_adapter_android_ = ime_adapter; | |
233 } | |
234 | |
235 base::WeakPtr<RenderWidgetHostViewAndroid> GetWeakPtrAndroid(); | |
236 | 231 |
237 bool OnTouchEvent(const ui::MotionEvent& event); | 232 bool OnTouchEvent(const ui::MotionEvent& event); |
238 bool OnTouchHandleEvent(const ui::MotionEvent& event); | 233 bool OnTouchHandleEvent(const ui::MotionEvent& event); |
239 void ResetGestureDetection(); | 234 void ResetGestureDetection(); |
240 void SetDoubleTapSupportEnabled(bool enabled); | 235 void SetDoubleTapSupportEnabled(bool enabled); |
241 void SetMultiTouchZoomSupportEnabled(bool enabled); | 236 void SetMultiTouchZoomSupportEnabled(bool enabled); |
242 | 237 |
| 238 long GetNativeImeAdapter(); |
| 239 |
243 void WasResized(); | 240 void WasResized(); |
244 | 241 |
245 bool HasValidFrame() const; | 242 bool HasValidFrame() const; |
246 | 243 |
247 void MoveCaret(const gfx::Point& point); | 244 void MoveCaret(const gfx::Point& point); |
248 void ShowContextMenuAtPoint(const gfx::Point& point); | 245 void ShowContextMenuAtPoint(const gfx::Point& point); |
249 void DismissTextHandles(); | 246 void DismissTextHandles(); |
250 void SetTextHandlesTemporarilyHidden(bool hidden); | 247 void SetTextHandlesTemporarilyHidden(bool hidden); |
251 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); | 248 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); |
252 | 249 |
(...skipping 14 matching lines...) Expand all Loading... |
267 RenderWidgetHostViewBase* updated_view, | 264 RenderWidgetHostViewBase* updated_view, |
268 bool did_change_state) override; | 265 bool did_change_state) override; |
269 void OnImeCompositionRangeChanged( | 266 void OnImeCompositionRangeChanged( |
270 TextInputManager* text_input_manager, | 267 TextInputManager* text_input_manager, |
271 RenderWidgetHostViewBase* updated_view) override; | 268 RenderWidgetHostViewBase* updated_view) override; |
272 void OnImeCancelComposition(TextInputManager* text_input_manager, | 269 void OnImeCancelComposition(TextInputManager* text_input_manager, |
273 RenderWidgetHostViewBase* updated_view) override; | 270 RenderWidgetHostViewBase* updated_view) override; |
274 void OnTextSelectionChanged(TextInputManager* text_input_manager, | 271 void OnTextSelectionChanged(TextInputManager* text_input_manager, |
275 RenderWidgetHostViewBase* updated_view) override; | 272 RenderWidgetHostViewBase* updated_view) override; |
276 | 273 |
277 ImeAdapterAndroid* ime_adapter_for_testing() { return ime_adapter_android_; } | 274 ImeAdapterAndroid* ime_adapter_for_testing() { return &ime_adapter_android_; } |
278 | 275 |
279 // Exposed for tests. | 276 // Exposed for tests. |
280 cc::SurfaceId SurfaceIdForTesting() const override; | 277 cc::SurfaceId SurfaceIdForTesting() const override; |
281 | 278 |
282 private: | 279 private: |
283 void RunAckCallbacks(); | 280 void RunAckCallbacks(); |
284 | 281 |
285 void SendReclaimCompositorResources(bool is_swap_ack); | 282 void SendReclaimCompositorResources(bool is_swap_ack); |
286 | 283 |
287 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, | 284 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 bool is_window_visible_; | 339 bool is_window_visible_; |
343 bool is_window_activity_started_; | 340 bool is_window_activity_started_; |
344 | 341 |
345 // Used to customize behavior for virtual reality mode, such as the | 342 // Used to customize behavior for virtual reality mode, such as the |
346 // appearance of overscroll glow and the keyboard. | 343 // appearance of overscroll glow and the keyboard. |
347 bool is_in_vr_; | 344 bool is_in_vr_; |
348 | 345 |
349 // ContentViewCoreImpl is our interface to the view system. | 346 // ContentViewCoreImpl is our interface to the view system. |
350 ContentViewCoreImpl* content_view_core_; | 347 ContentViewCoreImpl* content_view_core_; |
351 | 348 |
352 ImeAdapterAndroid* ime_adapter_android_; | 349 ImeAdapterAndroid ime_adapter_android_; |
353 | 350 |
354 // The background color of the widget. | 351 // The background color of the widget. |
355 SkColor background_color_; | 352 SkColor background_color_; |
356 | 353 |
357 // Body background color of the underlying document. | 354 // Body background color of the underlying document. |
358 SkColor cached_background_color_; | 355 SkColor cached_background_color_; |
359 | 356 |
360 mutable ui::ViewAndroid view_; | 357 mutable ui::ViewAndroid view_; |
361 | 358 |
362 // Manages the Compositor Frames received from the renderer. | 359 // Manages the Compositor Frames received from the renderer. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 nullptr; | 402 nullptr; |
406 | 403 |
407 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 404 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
408 | 405 |
409 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 406 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
410 }; | 407 }; |
411 | 408 |
412 } // namespace content | 409 } // namespace content |
413 | 410 |
414 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 411 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |