| 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 "content/browser/accessibility/browser_accessibility_manager.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 24 #include "content/browser/android/content_view_core_impl_observer.h" | 24 #include "content/browser/android/content_view_core_impl_observer.h" |
| 25 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 25 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
| 26 #include "content/browser/renderer_host/ime_adapter_android.h" | 26 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 27 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 27 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 29 #include "content/browser/renderer_host/text_input_manager.h" |
| 29 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
| 30 #include "content/public/browser/readback_types.h" | 31 #include "content/public/browser/readback_types.h" |
| 31 #include "gpu/command_buffer/common/mailbox.h" | 32 #include "gpu/command_buffer/common/mailbox.h" |
| 32 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
| 33 #include "ui/android/view_android.h" | 34 #include "ui/android/view_android.h" |
| 34 #include "ui/android/window_android_observer.h" | 35 #include "ui/android/window_android_observer.h" |
| 35 #include "ui/events/android/motion_event_android.h" | 36 #include "ui/events/android/motion_event_android.h" |
| 36 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 37 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
| 37 #include "ui/gfx/geometry/size.h" | 38 #include "ui/gfx/geometry/size.h" |
| 38 #include "ui/gfx/geometry/vector2d_f.h" | 39 #include "ui/gfx/geometry/vector2d_f.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // ----------------------------------------------------------------------------- | 71 // ----------------------------------------------------------------------------- |
| 71 // See comments in render_widget_host_view.h about this class and its members. | 72 // See comments in render_widget_host_view.h about this class and its members. |
| 72 // ----------------------------------------------------------------------------- | 73 // ----------------------------------------------------------------------------- |
| 73 class CONTENT_EXPORT RenderWidgetHostViewAndroid | 74 class CONTENT_EXPORT RenderWidgetHostViewAndroid |
| 74 : public RenderWidgetHostViewBase, | 75 : public RenderWidgetHostViewBase, |
| 75 public ui::GestureProviderClient, | 76 public ui::GestureProviderClient, |
| 76 public ui::WindowAndroidObserver, | 77 public ui::WindowAndroidObserver, |
| 77 public DelegatedFrameEvictorClient, | 78 public DelegatedFrameEvictorClient, |
| 78 public StylusTextSelectorClient, | 79 public StylusTextSelectorClient, |
| 79 public ui::TouchSelectionControllerClient, | 80 public ui::TouchSelectionControllerClient, |
| 80 public content::ContentViewCoreImplObserver { | 81 public content::ContentViewCoreImplObserver, |
| 82 public content::TextInputManager::Observer { |
| 81 public: | 83 public: |
| 82 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 84 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 83 ContentViewCoreImpl* content_view_core); | 85 ContentViewCoreImpl* content_view_core); |
| 84 ~RenderWidgetHostViewAndroid() override; | 86 ~RenderWidgetHostViewAndroid() override; |
| 85 | 87 |
| 86 void Blur(); | 88 void Blur(); |
| 87 | 89 |
| 88 // RenderWidgetHostView implementation. | 90 // RenderWidgetHostView implementation. |
| 89 bool OnMessageReceived(const IPC::Message& msg) override; | 91 bool OnMessageReceived(const IPC::Message& msg) override; |
| 90 void InitAsChild(gfx::NativeView parent_view) override; | 92 void InitAsChild(gfx::NativeView parent_view) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 void Hide() override; | 106 void Hide() override; |
| 105 bool IsShowing() override; | 107 bool IsShowing() override; |
| 106 gfx::Rect GetViewBounds() const override; | 108 gfx::Rect GetViewBounds() const override; |
| 107 gfx::Size GetVisibleViewportSize() const override; | 109 gfx::Size GetVisibleViewportSize() const override; |
| 108 gfx::Size GetPhysicalBackingSize() const override; | 110 gfx::Size GetPhysicalBackingSize() const override; |
| 109 bool DoBrowserControlsShrinkBlinkSize() const override; | 111 bool DoBrowserControlsShrinkBlinkSize() const override; |
| 110 float GetTopControlsHeight() const override; | 112 float GetTopControlsHeight() const override; |
| 111 float GetBottomControlsHeight() const override; | 113 float GetBottomControlsHeight() const override; |
| 112 void UpdateCursor(const WebCursor& cursor) override; | 114 void UpdateCursor(const WebCursor& cursor) override; |
| 113 void SetIsLoading(bool is_loading) override; | 115 void SetIsLoading(bool is_loading) override; |
| 114 void TextInputStateChanged(const TextInputState& params) override; | |
| 115 void ImeCancelComposition() override; | 116 void ImeCancelComposition() override; |
| 116 void ImeCompositionRangeChanged( | 117 void ImeCompositionRangeChanged( |
| 117 const gfx::Range& range, | 118 const gfx::Range& range, |
| 118 const std::vector<gfx::Rect>& character_bounds) override; | 119 const std::vector<gfx::Rect>& character_bounds) override; |
| 119 void FocusedNodeChanged(bool is_editable_node, | 120 void FocusedNodeChanged(bool is_editable_node, |
| 120 const gfx::Rect& node_bounds_in_screen) override; | 121 const gfx::Rect& node_bounds_in_screen) override; |
| 121 void RenderProcessGone(base::TerminationStatus status, | 122 void RenderProcessGone(base::TerminationStatus status, |
| 122 int error_code) override; | 123 int error_code) override; |
| 123 void Destroy() override; | 124 void Destroy() override; |
| 124 void SetTooltipText(const base::string16& tooltip_text) override; | 125 void SetTooltipText(const base::string16& tooltip_text) override; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void SynchronousFrameMetadata(cc::CompositorFrameMetadata frame_metadata); | 241 void SynchronousFrameMetadata(cc::CompositorFrameMetadata frame_metadata); |
| 241 | 242 |
| 242 void SetSynchronousCompositorClient(SynchronousCompositorClient* client); | 243 void SetSynchronousCompositorClient(SynchronousCompositorClient* client); |
| 243 | 244 |
| 244 SynchronousCompositorClient* synchronous_compositor_client() const { | 245 SynchronousCompositorClient* synchronous_compositor_client() const { |
| 245 return synchronous_compositor_client_; | 246 return synchronous_compositor_client_; |
| 246 } | 247 } |
| 247 | 248 |
| 248 static void OnContextLost(); | 249 static void OnContextLost(); |
| 249 | 250 |
| 251 // TextInputManager::Observer overrides. |
| 252 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, |
| 253 RenderWidgetHostViewBase* updated_view, |
| 254 bool did_change_state) override; |
| 255 |
| 250 private: | 256 private: |
| 251 void RunAckCallbacks(); | 257 void RunAckCallbacks(); |
| 252 | 258 |
| 253 void CheckCompositorFrameSinkChanged(uint32_t compositor_frame_sink_id); | 259 void CheckCompositorFrameSinkChanged(uint32_t compositor_frame_sink_id); |
| 254 void SubmitCompositorFrame(cc::CompositorFrame frame_data); | 260 void SubmitCompositorFrame(cc::CompositorFrame frame_data); |
| 255 void SendReclaimCompositorResources(uint32_t compositor_frame_sink_id, | 261 void SendReclaimCompositorResources(uint32_t compositor_frame_sink_id, |
| 256 bool is_swap_ack); | 262 bool is_swap_ack); |
| 257 | 263 |
| 258 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, | 264 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, |
| 259 bool is_transparent); | 265 bool is_transparent); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 gfx::Vector2dF last_scroll_offset_; | 386 gfx::Vector2dF last_scroll_offset_; |
| 381 | 387 |
| 382 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 388 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
| 383 | 389 |
| 384 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 390 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 385 }; | 391 }; |
| 386 | 392 |
| 387 } // namespace content | 393 } // namespace content |
| 388 | 394 |
| 389 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 395 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |