| 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 <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "cc/layers/delegated_frame_resource_collection.h" | 17 #include "cc/layers/delegated_frame_resource_collection.h" |
| 18 #include "cc/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
| 19 #include "content/browser/accessibility/browser_accessibility_manager.h" | 19 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 20 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 20 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
| 21 #include "content/browser/renderer_host/ime_adapter_android.h" | 21 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 22 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 22 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
| 23 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 23 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 25 #include "content/public/browser/readback_types.h" | 25 #include "content/public/browser/readback_types.h" |
| 26 #include "gpu/command_buffer/common/mailbox.h" | 26 #include "gpu/command_buffer/common/mailbox.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 29 #include "ui/base/android/window_android_observer.h" | 29 #include "ui/base/android/window_android_observer.h" |
| 30 #include "ui/base/ime/android/cursor_anchor_info_sender.h" |
| 30 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 31 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
| 31 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
| 32 #include "ui/gfx/geometry/vector2d_f.h" | 33 #include "ui/gfx/geometry/vector2d_f.h" |
| 33 #include "ui/touch_selection/touch_selection_controller.h" | 34 #include "ui/touch_selection/touch_selection_controller.h" |
| 34 | 35 |
| 35 struct ViewHostMsg_TextInputState_Params; | 36 struct ViewHostMsg_TextInputState_Params; |
| 36 | 37 |
| 37 namespace cc { | 38 namespace cc { |
| 38 class CopyOutputResult; | 39 class CopyOutputResult; |
| 39 class DelegatedFrameProvider; | 40 class DelegatedFrameProvider; |
| 40 class DelegatedRendererLayer; | 41 class DelegatedRendererLayer; |
| 41 class Layer; | 42 class Layer; |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 class WebExternalTextureLayer; | 46 class WebExternalTextureLayer; |
| 46 class WebTouchEvent; | 47 class WebTouchEvent; |
| 47 class WebMouseEvent; | 48 class WebMouseEvent; |
| 48 } | 49 } |
| 49 | 50 |
| 51 namespace ui { |
| 52 class CursorAnchorInfoBuilder; |
| 53 class CursorAnchorInfoController; |
| 54 } |
| 55 |
| 50 namespace content { | 56 namespace content { |
| 51 class ContentViewCoreImpl; | 57 class ContentViewCoreImpl; |
| 52 class OverscrollControllerAndroid; | 58 class OverscrollControllerAndroid; |
| 53 class RenderWidgetHost; | 59 class RenderWidgetHost; |
| 54 class RenderWidgetHostImpl; | 60 class RenderWidgetHostImpl; |
| 55 struct DidOverscrollParams; | 61 struct DidOverscrollParams; |
| 56 struct NativeWebKeyboardEvent; | 62 struct NativeWebKeyboardEvent; |
| 57 | 63 |
| 58 class ReadbackRequest { | 64 class ReadbackRequest { |
| 59 public: | 65 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 gfx::Rect src_subrect_; | 80 gfx::Rect src_subrect_; |
| 75 ReadbackRequestCallback result_callback_; | 81 ReadbackRequestCallback result_callback_; |
| 76 }; | 82 }; |
| 77 | 83 |
| 78 // ----------------------------------------------------------------------------- | 84 // ----------------------------------------------------------------------------- |
| 79 // See comments in render_widget_host_view.h about this class and its members. | 85 // See comments in render_widget_host_view.h about this class and its members. |
| 80 // ----------------------------------------------------------------------------- | 86 // ----------------------------------------------------------------------------- |
| 81 class CONTENT_EXPORT RenderWidgetHostViewAndroid | 87 class CONTENT_EXPORT RenderWidgetHostViewAndroid |
| 82 : public RenderWidgetHostViewBase, | 88 : public RenderWidgetHostViewBase, |
| 83 public cc::DelegatedFrameResourceCollectionClient, | 89 public cc::DelegatedFrameResourceCollectionClient, |
| 90 public ui::CursorAnchorInfoSender, |
| 84 public ui::GestureProviderClient, | 91 public ui::GestureProviderClient, |
| 85 public ui::WindowAndroidObserver, | 92 public ui::WindowAndroidObserver, |
| 86 public DelegatedFrameEvictorClient, | 93 public DelegatedFrameEvictorClient, |
| 87 public StylusTextSelectorClient, | 94 public StylusTextSelectorClient, |
| 88 public ui::TouchSelectionControllerClient { | 95 public ui::TouchSelectionControllerClient { |
| 89 public: | 96 public: |
| 90 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 97 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 91 ContentViewCoreImpl* content_view_core); | 98 ContentViewCoreImpl* content_view_core); |
| 92 virtual ~RenderWidgetHostViewAndroid(); | 99 virtual ~RenderWidgetHostViewAndroid(); |
| 93 | 100 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 override; | 183 override; |
| 177 virtual void LockCompositingSurface() override; | 184 virtual void LockCompositingSurface() override; |
| 178 virtual void UnlockCompositingSurface() override; | 185 virtual void UnlockCompositingSurface() override; |
| 179 virtual void OnTextSurroundingSelectionResponse(const base::string16& content, | 186 virtual void OnTextSurroundingSelectionResponse(const base::string16& content, |
| 180 size_t start_offset, | 187 size_t start_offset, |
| 181 size_t end_offset) override; | 188 size_t end_offset) override; |
| 182 | 189 |
| 183 // cc::DelegatedFrameResourceCollectionClient implementation. | 190 // cc::DelegatedFrameResourceCollectionClient implementation. |
| 184 virtual void UnusedResourcesAreAvailable() override; | 191 virtual void UnusedResourcesAreAvailable() override; |
| 185 | 192 |
| 193 // ui::CursorAnchorInfoControllerSender implementation. |
| 194 virtual void SendCursorAnchorInfo( |
| 195 ui::CursorAnchorInfoBuilder* builder) override; |
| 196 |
| 186 // ui::GestureProviderClient implementation. | 197 // ui::GestureProviderClient implementation. |
| 187 virtual void OnGestureEvent(const ui::GestureEventData& gesture) override; | 198 virtual void OnGestureEvent(const ui::GestureEventData& gesture) override; |
| 188 | 199 |
| 189 // ui::WindowAndroidObserver implementation. | 200 // ui::WindowAndroidObserver implementation. |
| 190 virtual void OnCompositingDidCommit() override; | 201 virtual void OnCompositingDidCommit() override; |
| 191 virtual void OnAttachCompositor() override; | 202 virtual void OnAttachCompositor() override; |
| 192 virtual void OnDetachCompositor() override; | 203 virtual void OnDetachCompositor() override; |
| 193 virtual void OnVSync(base::TimeTicks frame_time, | 204 virtual void OnVSync(base::TimeTicks frame_time, |
| 194 base::TimeDelta vsync_period) override; | 205 base::TimeDelta vsync_period) override; |
| 195 virtual void OnAnimate(base::TimeTicks begin_frame_time) override; | 206 virtual void OnAnimate(base::TimeTicks begin_frame_time) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 217 virtual scoped_ptr<ui::TouchHandleDrawable> CreateDrawable() override; | 228 virtual scoped_ptr<ui::TouchHandleDrawable> CreateDrawable() override; |
| 218 | 229 |
| 219 // Non-virtual methods | 230 // Non-virtual methods |
| 220 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 231 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 221 SkColor GetCachedBackgroundColor() const; | 232 SkColor GetCachedBackgroundColor() const; |
| 222 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 233 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
| 223 void SendMouseEvent(const blink::WebMouseEvent& event); | 234 void SendMouseEvent(const blink::WebMouseEvent& event); |
| 224 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 235 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
| 225 void SendGestureEvent(const blink::WebGestureEvent& event); | 236 void SendGestureEvent(const blink::WebGestureEvent& event); |
| 226 | 237 |
| 238 bool RequestCursorUpdates(uint32 cursor_update_mode); |
| 239 |
| 227 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); | 240 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); |
| 228 void OnDidChangeBodyBackgroundColor(SkColor color); | 241 void OnDidChangeBodyBackgroundColor(SkColor color); |
| 229 void OnStartContentIntent(const GURL& content_url); | 242 void OnStartContentIntent(const GURL& content_url); |
| 230 void OnSetNeedsBeginFrames(bool enabled); | 243 void OnSetNeedsBeginFrames(bool enabled); |
| 231 void OnSmartClipDataExtracted(const base::string16& text, | 244 void OnSmartClipDataExtracted(const base::string16& text, |
| 232 const base::string16& html, | 245 const base::string16& html, |
| 233 const gfx::Rect rect); | 246 const gfx::Rect rect); |
| 234 | 247 |
| 235 bool OnTouchEvent(const ui::MotionEvent& event); | 248 bool OnTouchEvent(const ui::MotionEvent& event); |
| 236 bool OnTouchHandleEvent(const ui::MotionEvent& event); | 249 bool OnTouchHandleEvent(const ui::MotionEvent& event); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // Used to control action dispatch at the next |OnVSync()| call. | 356 // Used to control action dispatch at the next |OnVSync()| call. |
| 344 uint32 outstanding_vsync_requests_; | 357 uint32 outstanding_vsync_requests_; |
| 345 | 358 |
| 346 bool is_showing_; | 359 bool is_showing_; |
| 347 | 360 |
| 348 // ContentViewCoreImpl is our interface to the view system. | 361 // ContentViewCoreImpl is our interface to the view system. |
| 349 ContentViewCoreImpl* content_view_core_; | 362 ContentViewCoreImpl* content_view_core_; |
| 350 | 363 |
| 351 ImeAdapterAndroid ime_adapter_android_; | 364 ImeAdapterAndroid ime_adapter_android_; |
| 352 | 365 |
| 366 scoped_ptr<ui::CursorAnchorInfoController> cursor_anchor_info_controller_; |
| 367 |
| 353 // Body background color of the underlying document. | 368 // Body background color of the underlying document. |
| 354 SkColor cached_background_color_; | 369 SkColor cached_background_color_; |
| 355 | 370 |
| 356 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 371 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
| 357 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 372 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
| 358 scoped_refptr<cc::DelegatedRendererLayer> layer_; | 373 scoped_refptr<cc::DelegatedRendererLayer> layer_; |
| 359 | 374 |
| 360 // The most recent texture size that was pushed to the texture layer. | 375 // The most recent texture size that was pushed to the texture layer. |
| 361 gfx::Size texture_size_in_layer_; | 376 gfx::Size texture_size_in_layer_; |
| 362 | 377 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 gfx::Vector2dF last_scroll_offset_; | 429 gfx::Vector2dF last_scroll_offset_; |
| 415 | 430 |
| 416 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 431 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
| 417 | 432 |
| 418 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 433 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 419 }; | 434 }; |
| 420 | 435 |
| 421 } // namespace content | 436 } // namespace content |
| 422 | 437 |
| 423 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 438 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |