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

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

Issue 1263703004: Revert of Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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"
34 #include "ui/events/gestures/motion_event_aura.h" 35 #include "ui/events/gestures/motion_event_aura.h"
35 #include "ui/gfx/display_observer.h" 36 #include "ui/gfx/display_observer.h"
36 #include "ui/gfx/geometry/insets.h" 37 #include "ui/gfx/geometry/insets.h"
37 #include "ui/gfx/geometry/rect.h" 38 #include "ui/gfx/geometry/rect.h"
38 #include "ui/wm/public/activation_delegate.h" 39 #include "ui/wm/public/activation_delegate.h"
39 40
40 namespace aura { 41 namespace aura {
41 class WindowTracker; 42 class WindowTracker;
42 namespace client { 43 namespace client {
43 class ScopedTooltipDisabler; 44 class ScopedTooltipDisabler;
(...skipping 13 matching lines...) Expand all
57 58
58 namespace gpu { 59 namespace gpu {
59 struct Mailbox; 60 struct Mailbox;
60 } 61 }
61 62
62 namespace ui { 63 namespace ui {
63 class CompositorLock; 64 class CompositorLock;
64 class InputMethod; 65 class InputMethod;
65 class LocatedEvent; 66 class LocatedEvent;
66 class Texture; 67 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;
80 79
81 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. 80 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
82 class CONTENT_EXPORT RenderWidgetHostViewAura 81 class CONTENT_EXPORT RenderWidgetHostViewAura
83 : public RenderWidgetHostViewBase, 82 : public RenderWidgetHostViewBase,
84 public DelegatedFrameHostClient, 83 public DelegatedFrameHostClient,
85 public BeginFrameObserverProxyClient, 84 public BeginFrameObserverProxyClient,
86 public ui::TextInputClient, 85 public ui::TextInputClient,
87 public gfx::DisplayObserver, 86 public gfx::DisplayObserver,
88 public aura::WindowTreeHostObserver, 87 public aura::WindowTreeHostObserver,
89 public aura::WindowDelegate, 88 public aura::WindowDelegate,
90 public aura::client::ActivationDelegate, 89 public aura::client::ActivationDelegate,
91 public aura::client::FocusChangeObserver, 90 public aura::client::FocusChangeObserver,
92 public aura::client::CursorClientObserver { 91 public aura::client::CursorClientObserver {
93 public: 92 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
94 // When |is_guest_view_hack| is true, this view isn't really the view for 136 // When |is_guest_view_hack| is true, this view isn't really the view for
95 // the |widget|, a RenderWidgetHostViewGuest is. 137 // the |widget|, a RenderWidgetHostViewGuest is.
96 // 138 //
97 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated 139 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
98 // to use RWHVChildFrame (http://crbug.com/330264). 140 // to use RWHVChildFrame (http://crbug.com/330264).
99 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack); 141 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
100 142
101 // RenderWidgetHostView implementation. 143 // RenderWidgetHostView implementation.
102 bool OnMessageReceived(const IPC::Message& msg) override; 144 bool OnMessageReceived(const IPC::Message& msg) override;
103 void InitAsChild(gfx::NativeView parent_view) override; 145 void InitAsChild(gfx::NativeView parent_view) override;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Method to indicate if this instance is shutting down or closing. 337 // Method to indicate if this instance is shutting down or closing.
296 // TODO(shrikant): Discuss around to see if it makes sense to add this method 338 // TODO(shrikant): Discuss around to see if it makes sense to add this method
297 // as part of RenderWidgetHostView. 339 // as part of RenderWidgetHostView.
298 bool IsClosing() const { return in_shutdown_; } 340 bool IsClosing() const { return in_shutdown_; }
299 341
300 // Sets whether the overscroll controller should be enabled for this page. 342 // Sets whether the overscroll controller should be enabled for this page.
301 void SetOverscrollControllerEnabled(bool enabled); 343 void SetOverscrollControllerEnabled(bool enabled);
302 344
303 void SnapToPhysicalPixelBoundary(); 345 void SnapToPhysicalPixelBoundary();
304 346
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
313 OverscrollController* overscroll_controller() const { 347 OverscrollController* overscroll_controller() const {
314 return overscroll_controller_.get(); 348 return overscroll_controller_.get();
315 } 349 }
316 350
317 // Called when the context menu is about to be displayed. 351 // Called when the context menu is about to be displayed.
318 void OnShowContextMenu(); 352 void OnShowContextMenu();
319 353
320 // Used in tests to set a mock client for touch selection controller. It will
321 // create a new touch selection controller for the new client.
322 void SetSelectionControllerClientForTest(
323 scoped_ptr<TouchSelectionControllerClientAura> client);
324
325 protected: 354 protected:
326 ~RenderWidgetHostViewAura() override; 355 ~RenderWidgetHostViewAura() override;
327 356
328 // Exposed for tests. 357 // Exposed for tests.
329 aura::Window* window() { return window_; } 358 aura::Window* window() { return window_; }
330 359
331 DelegatedFrameHost* GetDelegatedFrameHost() const { 360 DelegatedFrameHost* GetDelegatedFrameHost() const {
332 return delegated_frame_host_.get(); 361 return delegated_frame_host_.get();
333 } 362 }
334 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } 363 const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 bool CanRendererHandleEvent(const ui::MouseEvent* event, 503 bool CanRendererHandleEvent(const ui::MouseEvent* event,
475 bool mouse_locked, 504 bool mouse_locked,
476 bool selection_popup); 505 bool selection_popup);
477 506
478 // Called when the parent window bounds change. 507 // Called when the parent window bounds change.
479 void HandleParentBoundsChanged(); 508 void HandleParentBoundsChanged();
480 509
481 // Called when the parent window hierarchy for our window changes. 510 // Called when the parent window hierarchy for our window changes.
482 void ParentHierarchyChanged(); 511 void ParentHierarchyChanged();
483 512
484 // Helper function to be called whenever new selection information is
485 // received. It will update selection controller.
486 void SelectionUpdated(bool is_editable,
487 bool is_empty_text_form_control,
488 const ui::SelectionBound& start,
489 const ui::SelectionBound& end);
490
491 // Helper function to create a selection controller.
492 void CreateSelectionController();
493
494 // Performs gesture handling needed for touch text selection. Sets event as
495 // handled if it should not be further processed.
496 void HandleGestureForTouchSelection(ui::GestureEvent* event);
497
498 // The model object. 513 // The model object.
499 RenderWidgetHostImpl* host_; 514 RenderWidgetHostImpl* host_;
500 515
501 aura::Window* window_; 516 aura::Window* window_;
502 517
503 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; 518 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
504 519
505 scoped_ptr<WindowObserver> window_observer_; 520 scoped_ptr<WindowObserver> window_observer_;
506 521
507 // Tracks the ancestors of the RWHVA window for window location changes. 522 // Tracks the ancestors of the RWHVA window for window location changes.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // exercise. 640 // exercise.
626 bool legacy_window_destroyed_; 641 bool legacy_window_destroyed_;
627 642
628 // Set to true when a context menu is being displayed. Reset to false when 643 // Set to true when a context menu is being displayed. Reset to false when
629 // a mouse leave is received in this context. 644 // a mouse leave is received in this context.
630 bool showing_context_menu_; 645 bool showing_context_menu_;
631 #endif 646 #endif
632 647
633 bool has_snapped_to_boundary_; 648 bool has_snapped_to_boundary_;
634 649
635 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_; 650 TouchEditingClient* touch_editing_client_;
636 scoped_ptr<ui::TouchSelectionController> selection_controller_;
637 651
638 scoped_ptr<OverscrollController> overscroll_controller_; 652 scoped_ptr<OverscrollController> overscroll_controller_;
639 653
640 // The last scroll offset of the view. 654 // The last scroll offset of the view.
641 gfx::Vector2dF last_scroll_offset_; 655 gfx::Vector2dF last_scroll_offset_;
642 656
643 gfx::Insets insets_; 657 gfx::Insets insets_;
644 658
645 std::vector<ui::LatencyInfo> software_latency_info_; 659 std::vector<ui::LatencyInfo> software_latency_info_;
646 660
(...skipping 12 matching lines...) Expand all
659 673
660 BeginFrameObserverProxy begin_frame_observer_proxy_; 674 BeginFrameObserverProxy begin_frame_observer_proxy_;
661 675
662 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; 676 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
663 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 677 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
664 }; 678 };
665 679
666 } // namespace content 680 } // namespace content
667 681
668 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 682 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698