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

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: Addressed review comments 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Method to indicate if this instance is shutting down or closing. 297 // Method to indicate if this instance is shutting down or closing.
340 // TODO(shrikant): Discuss around to see if it makes sense to add this method 298 // TODO(shrikant): Discuss around to see if it makes sense to add this method
341 // as part of RenderWidgetHostView. 299 // as part of RenderWidgetHostView.
342 bool IsClosing() const { return in_shutdown_; } 300 bool IsClosing() const { return in_shutdown_; }
343 301
344 // Sets whether the overscroll controller should be enabled for this page. 302 // Sets whether the overscroll controller should be enabled for this page.
345 void SetOverscrollControllerEnabled(bool enabled); 303 void SetOverscrollControllerEnabled(bool enabled);
346 304
347 void SnapToPhysicalPixelBoundary(); 305 void SnapToPhysicalPixelBoundary();
348 306
307 ui::TouchSelectionController* selection_controller() const {
308 return selection_controller_.get();
309 }
310
311 TouchSelectionControllerClientAura* selection_controller_client() const {
312 return selection_controller_client_.get();
313 }
314
349 OverscrollController* overscroll_controller() const { 315 OverscrollController* overscroll_controller() const {
350 return overscroll_controller_.get(); 316 return overscroll_controller_.get();
351 } 317 }
352 318
353 // Called when the context menu is about to be displayed. 319 // Called when the context menu is about to be displayed.
354 void OnShowContextMenu(); 320 void OnShowContextMenu();
355 321
356 protected: 322 protected:
357 ~RenderWidgetHostViewAura() override; 323 ~RenderWidgetHostViewAura() override;
358 324
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 bool CanRendererHandleEvent(const ui::MouseEvent* event, 471 bool CanRendererHandleEvent(const ui::MouseEvent* event,
506 bool mouse_locked, 472 bool mouse_locked,
507 bool selection_popup); 473 bool selection_popup);
508 474
509 // Called when the parent window bounds change. 475 // Called when the parent window bounds change.
510 void HandleParentBoundsChanged(); 476 void HandleParentBoundsChanged();
511 477
512 // Called when the parent window hierarchy for our window changes. 478 // Called when the parent window hierarchy for our window changes.
513 void ParentHierarchyChanged(); 479 void ParentHierarchyChanged();
514 480
481 // Helper function to be called whenever new selection information is
482 // received. It will update selection controller.
483 void SelectionUpdated(bool is_editable,
484 bool is_empty_text_form_control,
485 const ui::SelectionBound& start,
486 const ui::SelectionBound& end);
487
488 // Performs gesture handling needed for touch text selection. Sets event as
489 // handled if it should not be further processed.
490 void HandleGestureForTouchSelection(ui::GestureEvent* event);
491
515 // The model object. 492 // The model object.
516 RenderWidgetHostImpl* host_; 493 RenderWidgetHostImpl* host_;
517 494
518 aura::Window* window_; 495 aura::Window* window_;
519 496
520 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; 497 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
521 498
522 scoped_ptr<WindowObserver> window_observer_; 499 scoped_ptr<WindowObserver> window_observer_;
523 500
524 // Tracks the ancestors of the RWHVA window for window location changes. 501 // Tracks the ancestors of the RWHVA window for window location changes.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // exercise. 619 // exercise.
643 bool legacy_window_destroyed_; 620 bool legacy_window_destroyed_;
644 621
645 // Set to true when a context menu is being displayed. Reset to false when 622 // Set to true when a context menu is being displayed. Reset to false when
646 // a mouse leave is received in this context. 623 // a mouse leave is received in this context.
647 bool showing_context_menu_; 624 bool showing_context_menu_;
648 #endif 625 #endif
649 626
650 bool has_snapped_to_boundary_; 627 bool has_snapped_to_boundary_;
651 628
652 TouchEditingClient* touch_editing_client_; 629 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_;
630 scoped_ptr<ui::TouchSelectionController> selection_controller_;
653 631
654 scoped_ptr<OverscrollController> overscroll_controller_; 632 scoped_ptr<OverscrollController> overscroll_controller_;
655 633
656 // The last scroll offset of the view. 634 // The last scroll offset of the view.
657 gfx::Vector2dF last_scroll_offset_; 635 gfx::Vector2dF last_scroll_offset_;
658 636
659 gfx::Insets insets_; 637 gfx::Insets insets_;
660 638
661 std::vector<ui::LatencyInfo> software_latency_info_; 639 std::vector<ui::LatencyInfo> software_latency_info_;
662 640
(...skipping 12 matching lines...) Expand all
675 653
676 BeginFrameObserverProxy begin_frame_observer_proxy_; 654 BeginFrameObserverProxy begin_frame_observer_proxy_;
677 655
678 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; 656 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
679 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 657 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
680 }; 658 };
681 659
682 } // namespace content 660 } // namespace content
683 661
684 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 662 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698