Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.h

Issue 335943002: [Android] Composited selection handle rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_native_handles_final
Patch Set: Clean up paste popup interaction Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/image_transport_factory_android.h" 21 #include "content/browser/renderer_host/image_transport_factory_android.h"
22 #include "content/browser/renderer_host/ime_adapter_android.h" 22 #include "content/browser/renderer_host/ime_adapter_android.h"
23 #include "content/browser/renderer_host/input/gesture_text_selector.h" 23 #include "content/browser/renderer_host/input/gesture_text_selector.h"
24 #include "content/browser/renderer_host/input/touch_selection_controller.h"
24 #include "content/browser/renderer_host/render_widget_host_view_base.h" 25 #include "content/browser/renderer_host/render_widget_host_view_base.h"
25 #include "content/common/content_export.h" 26 #include "content/common/content_export.h"
26 #include "gpu/command_buffer/common/mailbox.h" 27 #include "gpu/command_buffer/common/mailbox.h"
27 #include "third_party/skia/include/core/SkColor.h" 28 #include "third_party/skia/include/core/SkColor.h"
28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
29 #include "ui/base/android/window_android_observer.h" 30 #include "ui/base/android/window_android_observer.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/size.h" 32 #include "ui/gfx/size.h"
32 #include "ui/gfx/vector2d_f.h" 33 #include "ui/gfx/vector2d_f.h"
33 34
(...skipping 26 matching lines...) Expand all
60 // ----------------------------------------------------------------------------- 61 // -----------------------------------------------------------------------------
61 // See comments in render_widget_host_view.h about this class and its members. 62 // See comments in render_widget_host_view.h about this class and its members.
62 // ----------------------------------------------------------------------------- 63 // -----------------------------------------------------------------------------
63 class CONTENT_EXPORT RenderWidgetHostViewAndroid 64 class CONTENT_EXPORT RenderWidgetHostViewAndroid
64 : public RenderWidgetHostViewBase, 65 : public RenderWidgetHostViewBase,
65 public cc::DelegatedFrameResourceCollectionClient, 66 public cc::DelegatedFrameResourceCollectionClient,
66 public ImageTransportFactoryAndroidObserver, 67 public ImageTransportFactoryAndroidObserver,
67 public ui::GestureProviderClient, 68 public ui::GestureProviderClient,
68 public ui::WindowAndroidObserver, 69 public ui::WindowAndroidObserver,
69 public DelegatedFrameEvictorClient, 70 public DelegatedFrameEvictorClient,
70 public GestureTextSelectorClient { 71 public GestureTextSelectorClient,
72 public TouchSelectionControllerClient {
71 public: 73 public:
72 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, 74 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget,
73 ContentViewCoreImpl* content_view_core); 75 ContentViewCoreImpl* content_view_core);
74 virtual ~RenderWidgetHostViewAndroid(); 76 virtual ~RenderWidgetHostViewAndroid();
75 77
76 // RenderWidgetHostView implementation. 78 // RenderWidgetHostView implementation.
77 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 79 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
78 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; 80 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
79 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 81 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
80 const gfx::Rect& pos) OVERRIDE; 82 const gfx::Rect& pos) OVERRIDE;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); 205 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
204 void SendGestureEvent(const blink::WebGestureEvent& event); 206 void SendGestureEvent(const blink::WebGestureEvent& event);
205 207
206 void OnDidChangeBodyBackgroundColor(SkColor color); 208 void OnDidChangeBodyBackgroundColor(SkColor color);
207 void OnStartContentIntent(const GURL& content_url); 209 void OnStartContentIntent(const GURL& content_url);
208 void OnSetNeedsBeginFrame(bool enabled); 210 void OnSetNeedsBeginFrame(bool enabled);
209 void OnSmartClipDataExtracted(const base::string16& result, 211 void OnSmartClipDataExtracted(const base::string16& result,
210 const gfx::Rect rect); 212 const gfx::Rect rect);
211 213
212 bool OnTouchEvent(const ui::MotionEvent& event); 214 bool OnTouchEvent(const ui::MotionEvent& event);
215 bool OnTouchHandleEvent(const ui::MotionEvent& event);
213 void ResetGestureDetection(); 216 void ResetGestureDetection();
214 void SetDoubleTapSupportEnabled(bool enabled); 217 void SetDoubleTapSupportEnabled(bool enabled);
215 void SetMultiTouchZoomSupportEnabled(bool enabled); 218 void SetMultiTouchZoomSupportEnabled(bool enabled);
216 219
217 long GetNativeImeAdapter(); 220 long GetNativeImeAdapter();
218 221
219 void WasResized(); 222 void WasResized();
220 223
221 void GetScaledContentBitmap( 224 void GetScaledContentBitmap(
222 float scale, 225 float scale,
223 SkBitmap::Config bitmap_config, 226 SkBitmap::Config bitmap_config,
224 gfx::Rect src_subrect, 227 gfx::Rect src_subrect,
225 const base::Callback<void(bool, const SkBitmap&)>& result_callback); 228 const base::Callback<void(bool, const SkBitmap&)>& result_callback);
226 229
227 bool HasValidFrame() const; 230 bool HasValidFrame() const;
228 231
229 void MoveCaret(const gfx::Point& point); 232 void MoveCaret(const gfx::Point& point);
233 void HideTextHandles();
230 234
231 void SynchronousFrameMetadata( 235 void SynchronousFrameMetadata(
232 const cc::CompositorFrameMetadata& frame_metadata); 236 const cc::CompositorFrameMetadata& frame_metadata);
233 237
234 void SetOverlayVideoMode(bool enabled); 238 void SetOverlayVideoMode(bool enabled);
235 239
236 typedef base::Callback< 240 typedef base::Callback<
237 void(const base::string16& content, int start_offset, int end_offset)> 241 void(const base::string16& content, int start_offset, int end_offset)>
238 TextSurroundingSelectionCallback; 242 TextSurroundingSelectionCallback;
239 void SetTextSurroundingSelectionCallback( 243 void SetTextSurroundingSelectionCallback(
240 const TextSurroundingSelectionCallback& callback); 244 const TextSurroundingSelectionCallback& callback);
241 245
242 private: 246 private:
247 // TouchSelectionControllerClient implementation.
248 virtual void SetNeedsAnimate() OVERRIDE;
249 virtual void MoveCaret(const gfx::PointF& position) OVERRIDE;
250 virtual void SelectBetweenCoordinates(const gfx::PointF& start,
251 const gfx::PointF& end) OVERRIDE;
252 virtual void OnSelectionEvent(SelectionEventType event,
253 const gfx::PointF& anchor_position) OVERRIDE;
254 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() OVERRIDE;
255
243 void RunAckCallbacks(); 256 void RunAckCallbacks();
244 257
245 void DestroyDelegatedContent(); 258 void DestroyDelegatedContent();
246 void SwapDelegatedFrame(uint32 output_surface_id, 259 void SwapDelegatedFrame(uint32 output_surface_id,
247 scoped_ptr<cc::DelegatedFrameData> frame_data); 260 scoped_ptr<cc::DelegatedFrameData> frame_data);
248 void SendDelegatedFrameAck(uint32 output_surface_id); 261 void SendDelegatedFrameAck(uint32 output_surface_id);
249 void SendReturnedDelegatedResources(uint32 output_surface_id); 262 void SendReturnedDelegatedResources(uint32 output_surface_id);
250 263
251 void OnFrameMetadataUpdated( 264 void OnFrameMetadataUpdated(
252 const cc::CompositorFrameMetadata& frame_metadata); 265 const cc::CompositorFrameMetadata& frame_metadata);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 void ReleaseLocksOnSurface(); 300 void ReleaseLocksOnSurface();
288 301
289 // Drop any incoming frames from the renderer when there are locks on the 302 // Drop any incoming frames from the renderer when there are locks on the
290 // current frame. 303 // current frame.
291 void RetainFrame(uint32 output_surface_id, 304 void RetainFrame(uint32 output_surface_id,
292 scoped_ptr<cc::CompositorFrame> frame); 305 scoped_ptr<cc::CompositorFrame> frame);
293 306
294 void InternalSwapCompositorFrame(uint32 output_surface_id, 307 void InternalSwapCompositorFrame(uint32 output_surface_id,
295 scoped_ptr<cc::CompositorFrame> frame); 308 scoped_ptr<cc::CompositorFrame> frame);
296 309
297 void SetNeedsAnimate();
298 bool Animate(base::TimeTicks frame_time); 310 bool Animate(base::TimeTicks frame_time);
299 311
312 float GetDpiScale() const;
313
300 // The model object. 314 // The model object.
301 RenderWidgetHostImpl* host_; 315 RenderWidgetHostImpl* host_;
302 316
303 // Used to track whether this render widget needs a BeginFrame. 317 // Used to track whether this render widget needs a BeginFrame.
304 bool needs_begin_frame_; 318 bool needs_begin_frame_;
305 319
306 bool is_showing_; 320 bool is_showing_;
307 321
308 // ContentViewCoreImpl is our interface to the view system. 322 // ContentViewCoreImpl is our interface to the view system.
309 ContentViewCoreImpl* content_view_core_; 323 ContentViewCoreImpl* content_view_core_;
(...skipping 28 matching lines...) Expand all
338 // Note: |overscroll_effect_| will never be NULL, even if it's never enabled. 352 // Note: |overscroll_effect_| will never be NULL, even if it's never enabled.
339 scoped_ptr<OverscrollGlow> overscroll_effect_; 353 scoped_ptr<OverscrollGlow> overscroll_effect_;
340 354
341 // Provides gesture synthesis given a stream of touch events (derived from 355 // Provides gesture synthesis given a stream of touch events (derived from
342 // Android MotionEvent's) and touch event acks. 356 // Android MotionEvent's) and touch event acks.
343 ui::FilteredGestureProvider gesture_provider_; 357 ui::FilteredGestureProvider gesture_provider_;
344 358
345 // Handles gesture based text selection 359 // Handles gesture based text selection
346 GestureTextSelector gesture_text_selector_; 360 GestureTextSelector gesture_text_selector_;
347 361
362 // Manages selection handle rendering and manipulation.
363 // This will always be NULL if |content_view_core_| is NULL.
364 scoped_ptr<TouchSelectionController> selection_controller_;
365
348 bool flush_input_requested_; 366 bool flush_input_requested_;
349 367
350 int accelerated_surface_route_id_; 368 int accelerated_surface_route_id_;
351 369
352 // Size to use if we have no backing ContentViewCore 370 // Size to use if we have no backing ContentViewCore
353 gfx::Size default_size_; 371 gfx::Size default_size_;
354 372
355 // Cached rectangles for the selection anchor and focus.
356 cc::ViewportSelectionBound cached_selection_anchor_;
357 cc::ViewportSelectionBound cached_selection_focus_;
358
359 const bool using_synchronous_compositor_; 373 const bool using_synchronous_compositor_;
360 374
361 scoped_ptr<DelegatedFrameEvictor> frame_evictor_; 375 scoped_ptr<DelegatedFrameEvictor> frame_evictor_;
362 376
363 size_t locks_on_frame_count_; 377 size_t locks_on_frame_count_;
364 bool observing_root_window_; 378 bool observing_root_window_;
365 379
366 struct LastFrameInfo { 380 struct LastFrameInfo {
367 LastFrameInfo(uint32 output_id, 381 LastFrameInfo(uint32 output_id,
368 scoped_ptr<cc::CompositorFrame> output_frame); 382 scoped_ptr<cc::CompositorFrame> output_frame);
369 ~LastFrameInfo(); 383 ~LastFrameInfo();
370 uint32 output_surface_id; 384 uint32 output_surface_id;
371 scoped_ptr<cc::CompositorFrame> frame; 385 scoped_ptr<cc::CompositorFrame> frame;
372 }; 386 };
373 387
374 scoped_ptr<LastFrameInfo> last_frame_info_; 388 scoped_ptr<LastFrameInfo> last_frame_info_;
375 389
376 TextSurroundingSelectionCallback text_surrounding_selection_callback_; 390 TextSurroundingSelectionCallback text_surrounding_selection_callback_;
377 391
378 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 392 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
379 }; 393 };
380 394
381 } // namespace content 395 } // namespace content
382 396
383 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 397 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698