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

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

Issue 698253004: Reland: Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added scoped helper for MotionEventAura Created 5 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_AURA_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 #include "content/browser/renderer_host/render_widget_host_view_base.h" 24 #include "content/browser/renderer_host/render_widget_host_view_base.h"
25 #include "content/common/content_export.h" 25 #include "content/common/content_export.h"
26 #include "content/common/cursors/webcursor.h" 26 #include "content/common/cursors/webcursor.h"
27 #include "third_party/skia/include/core/SkRegion.h" 27 #include "third_party/skia/include/core/SkRegion.h"
28 #include "ui/aura/client/cursor_client_observer.h" 28 #include "ui/aura/client/cursor_client_observer.h"
29 #include "ui/aura/client/focus_change_observer.h" 29 #include "ui/aura/client/focus_change_observer.h"
30 #include "ui/aura/window_delegate.h" 30 #include "ui/aura/window_delegate.h"
31 #include "ui/aura/window_tree_host_observer.h" 31 #include "ui/aura/window_tree_host_observer.h"
32 #include "ui/base/ime/text_input_client.h" 32 #include "ui/base/ime/text_input_client.h"
33 #include "ui/base/touch/selection_bound.h" 33 #include "ui/base/touch/selection_bound.h"
34 #include "ui/base/touch/touch_editing_controller.h"
35 #include "ui/events/gestures/motion_event_aura.h" 34 #include "ui/events/gestures/motion_event_aura.h"
36 #include "ui/gfx/display_observer.h" 35 #include "ui/gfx/display_observer.h"
37 #include "ui/gfx/geometry/insets.h" 36 #include "ui/gfx/geometry/insets.h"
38 #include "ui/gfx/geometry/rect.h" 37 #include "ui/gfx/geometry/rect.h"
39 #include "ui/wm/public/activation_delegate.h" 38 #include "ui/wm/public/activation_delegate.h"
40 39
41 namespace aura { 40 namespace aura {
42 class WindowTracker; 41 class WindowTracker;
43 namespace client { 42 namespace client {
44 class ScopedTooltipDisabler; 43 class ScopedTooltipDisabler;
(...skipping 13 matching lines...) Expand all
58 57
59 namespace gpu { 58 namespace gpu {
60 struct Mailbox; 59 struct Mailbox;
61 } 60 }
62 61
63 namespace ui { 62 namespace ui {
64 class CompositorLock; 63 class CompositorLock;
65 class InputMethod; 64 class InputMethod;
66 class LocatedEvent; 65 class LocatedEvent;
67 class Texture; 66 class Texture;
67 class TouchSelectionController;
68 } 68 }
69 69
70 namespace content { 70 namespace content {
71 #if defined(OS_WIN) 71 #if defined(OS_WIN)
72 class LegacyRenderWidgetHostHWND; 72 class LegacyRenderWidgetHostHWND;
73 #endif 73 #endif
74 74
75 class OverscrollController; 75 class OverscrollController;
76 class RenderFrameHostImpl; 76 class RenderFrameHostImpl;
77 class RenderWidgetHostImpl; 77 class RenderWidgetHostImpl;
78 class RenderWidgetHostView; 78 class RenderWidgetHostView;
79 class TouchSelectionControllerClientAura;
79 80
80 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. 81 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
81 class CONTENT_EXPORT RenderWidgetHostViewAura 82 class CONTENT_EXPORT RenderWidgetHostViewAura
82 : public RenderWidgetHostViewBase, 83 : public RenderWidgetHostViewBase,
83 public DelegatedFrameHostClient, 84 public DelegatedFrameHostClient,
84 public BeginFrameObserverProxyClient, 85 public BeginFrameObserverProxyClient,
85 public ui::TextInputClient, 86 public ui::TextInputClient,
86 public gfx::DisplayObserver, 87 public gfx::DisplayObserver,
87 public aura::WindowTreeHostObserver, 88 public aura::WindowTreeHostObserver,
88 public aura::WindowDelegate, 89 public aura::WindowDelegate,
89 public aura::client::ActivationDelegate, 90 public aura::client::ActivationDelegate,
90 public aura::client::FocusChangeObserver, 91 public aura::client::FocusChangeObserver,
91 public aura::client::CursorClientObserver { 92 public aura::client::CursorClientObserver {
92 public: 93 public:
93 // Displays and controls touch editing elements such as selection handles.
94 class TouchEditingClient {
95 public:
96 TouchEditingClient() {}
97
98 // Tells the client to start showing touch editing handles.
99 virtual void StartTouchEditing() = 0;
100
101 // Notifies the client that touch editing is no longer needed. |quick|
102 // determines whether the handles should fade out quickly or slowly.
103 virtual void EndTouchEditing(bool quick) = 0;
104
105 // Notifies the client that the selection bounds need to be updated.
106 virtual void OnSelectionOrCursorChanged(
107 const ui::SelectionBound& anchor,
108 const ui::SelectionBound& focus) = 0;
109
110 // Notifies the client that the current text input type as changed.
111 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
112
113 // Notifies the client that an input event is about to be sent to the
114 // renderer. Returns true if the client wants to stop event propagation.
115 virtual bool HandleInputEvent(const ui::Event* event) = 0;
116
117 // Notifies the client that a gesture event ack was received.
118 virtual void GestureEventAck(int gesture_event_type) = 0;
119
120 // Notifies the client that the fling has ended, so it can activate touch
121 // editing if needed.
122 virtual void DidStopFlinging() = 0;
123
124 // This is called when the view is destroyed, so that the client can
125 // perform any necessary clean-up.
126 virtual void OnViewDestroyed() = 0;
127
128 protected:
129 virtual ~TouchEditingClient() {}
130 };
131
132 void set_touch_editing_client(TouchEditingClient* client) {
133 touch_editing_client_ = client;
134 }
135
136 // When |is_guest_view_hack| is true, this view isn't really the view for 94 // When |is_guest_view_hack| is true, this view isn't really the view for
137 // the |widget|, a RenderWidgetHostViewGuest is. 95 // the |widget|, a RenderWidgetHostViewGuest is.
138 // 96 //
139 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated 97 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
140 // to use RWHVChildFrame (http://crbug.com/330264). 98 // to use RWHVChildFrame (http://crbug.com/330264).
141 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack); 99 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
142 100
143 // RenderWidgetHostView implementation. 101 // RenderWidgetHostView implementation.
144 bool OnMessageReceived(const IPC::Message& msg) override; 102 bool OnMessageReceived(const IPC::Message& msg) override;
145 void InitAsChild(gfx::NativeView parent_view) override; 103 void InitAsChild(gfx::NativeView parent_view) override;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Method to indicate if this instance is shutting down or closing. 295 // Method to indicate if this instance is shutting down or closing.
338 // TODO(shrikant): Discuss around to see if it makes sense to add this method 296 // TODO(shrikant): Discuss around to see if it makes sense to add this method
339 // as part of RenderWidgetHostView. 297 // as part of RenderWidgetHostView.
340 bool IsClosing() const { return in_shutdown_; } 298 bool IsClosing() const { return in_shutdown_; }
341 299
342 // Sets whether the overscroll controller should be enabled for this page. 300 // Sets whether the overscroll controller should be enabled for this page.
343 void SetOverscrollControllerEnabled(bool enabled); 301 void SetOverscrollControllerEnabled(bool enabled);
344 302
345 void SnapToPhysicalPixelBoundary(); 303 void SnapToPhysicalPixelBoundary();
346 304
305 ui::TouchSelectionController* selection_controller() const {
306 return selection_controller_.get();
307 }
308
309 TouchSelectionControllerClientAura* selection_controller_client() const {
310 return selection_controller_client_.get();
311 }
312
347 OverscrollController* overscroll_controller() const { 313 OverscrollController* overscroll_controller() const {
348 return overscroll_controller_.get(); 314 return overscroll_controller_.get();
349 } 315 }
350 316
351 // Called when the context menu is about to be displayed. 317 // Called when the context menu is about to be displayed.
352 void OnShowContextMenu(); 318 void OnShowContextMenu();
353 319
354 protected: 320 protected:
355 ~RenderWidgetHostViewAura() override; 321 ~RenderWidgetHostViewAura() override;
356 322
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 bool CanRendererHandleEvent(const ui::MouseEvent* event, 469 bool CanRendererHandleEvent(const ui::MouseEvent* event,
504 bool mouse_locked, 470 bool mouse_locked,
505 bool selection_popup); 471 bool selection_popup);
506 472
507 // Called when the parent window bounds change. 473 // Called when the parent window bounds change.
508 void HandleParentBoundsChanged(); 474 void HandleParentBoundsChanged();
509 475
510 // Called when the parent window hierarchy for our window changes. 476 // Called when the parent window hierarchy for our window changes.
511 void ParentHierarchyChanged(); 477 void ParentHierarchyChanged();
512 478
479 // Helper function to be called whenever new selection information is
480 // received. It will update selection controller.
481 void SelectionUpdated(bool is_editable,
482 bool is_empty_text_form_control,
483 const ui::SelectionBound& start,
484 const ui::SelectionBound& end);
485
486 // Performs gesture handling needed for touch text selection. Sets event as
487 // handled if it should not be further processed.
488 void HandleGestureForTouchSelection(ui::GestureEvent* event);
489
513 // The model object. 490 // The model object.
514 RenderWidgetHostImpl* host_; 491 RenderWidgetHostImpl* host_;
515 492
516 aura::Window* window_; 493 aura::Window* window_;
517 494
518 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; 495 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
519 496
520 scoped_ptr<WindowObserver> window_observer_; 497 scoped_ptr<WindowObserver> window_observer_;
521 498
522 // Tracks the ancestors of the RWHVA window for window location changes. 499 // Tracks the ancestors of the RWHVA window for window location changes.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // exercise. 617 // exercise.
641 bool legacy_window_destroyed_; 618 bool legacy_window_destroyed_;
642 619
643 // Set to true when a context menu is being displayed. Reset to false when 620 // Set to true when a context menu is being displayed. Reset to false when
644 // a mouse leave is received in this context. 621 // a mouse leave is received in this context.
645 bool showing_context_menu_; 622 bool showing_context_menu_;
646 #endif 623 #endif
647 624
648 bool has_snapped_to_boundary_; 625 bool has_snapped_to_boundary_;
649 626
650 TouchEditingClient* touch_editing_client_; 627 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_;
628 scoped_ptr<ui::TouchSelectionController> selection_controller_;
651 629
652 scoped_ptr<OverscrollController> overscroll_controller_; 630 scoped_ptr<OverscrollController> overscroll_controller_;
653 631
654 // The last scroll offset of the view. 632 // The last scroll offset of the view.
655 gfx::Vector2dF last_scroll_offset_; 633 gfx::Vector2dF last_scroll_offset_;
656 634
657 gfx::Insets insets_; 635 gfx::Insets insets_;
658 636
659 std::vector<ui::LatencyInfo> software_latency_info_; 637 std::vector<ui::LatencyInfo> software_latency_info_;
660 638
(...skipping 12 matching lines...) Expand all
673 651
674 BeginFrameObserverProxy begin_frame_observer_proxy_; 652 BeginFrameObserverProxy begin_frame_observer_proxy_;
675 653
676 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; 654 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
677 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 655 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
678 }; 656 };
679 657
680 } // namespace content 658 } // namespace content
681 659
682 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 660 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698