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

Unified 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: Rebase by Mikhail Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.h
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 81e794383f494de5966a3f87e7b6b4a05983c1bb..be9dee36d9c05b400835d9063572f0a0db4dddf9 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -21,6 +21,7 @@
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/compositor/owned_mailbox.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/renderer_host/touch_selection_controller_aura.h"
#include "content/common/content_export.h"
#include "content/common/cursors/webcursor.h"
#include "third_party/skia/include/core/SkRegion.h"
@@ -86,50 +87,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
public aura::client::ActivationChangeObserver,
public aura::client::FocusChangeObserver,
public aura::client::CursorClientObserver,
- public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
+ public base::SupportsWeakPtr<RenderWidgetHostViewAura>,
+ public TouchSelectionControllerAuraClient {
public:
- // Displays and controls touch editing elements such as selection handles.
- class TouchEditingClient {
- public:
- TouchEditingClient() {}
-
- // Tells the client to start showing touch editing handles.
- virtual void StartTouchEditing() = 0;
-
- // Notifies the client that touch editing is no longer needed. |quick|
- // determines whether the handles should fade out quickly or slowly.
- virtual void EndTouchEditing(bool quick) = 0;
-
- // Notifies the client that the selection bounds need to be updated.
- virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
- const gfx::Rect& focus) = 0;
-
- // Notifies the client that the current text input type as changed.
- virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
-
- // Notifies the client that an input event is about to be sent to the
- // renderer. Returns true if the client wants to stop event propagation.
- virtual bool HandleInputEvent(const ui::Event* event) = 0;
-
- // Notifies the client that a gesture event ack was received.
- virtual void GestureEventAck(int gesture_event_type) = 0;
-
- // Notifies the client that the fling has ended, so it can activate touch
- // editing if needed.
- virtual void DidStopFlinging() = 0;
-
- // This is called when the view is destroyed, so that the client can
- // perform any necessary clean-up.
- virtual void OnViewDestroyed() = 0;
-
- protected:
- virtual ~TouchEditingClient() {}
- };
-
- void set_touch_editing_client(TouchEditingClient* client) {
- touch_editing_client_ = client;
- }
-
// When |is_guest_view_hack| is true, this view isn't really the view for
// the |widget|, a RenderWidgetHostViewGuest is.
//
@@ -298,6 +258,18 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
void OnTouchEvent(ui::TouchEvent* event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
+ // Overriden from TouchSelectionControllerAuraClient:
+ virtual float GetDeviceScaleFactor() override;
+ virtual void MoveCaret(const gfx::PointF& position) override;
+ virtual void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
+ virtual void SelectBetweenCoordinates(const gfx::PointF& base,
+ const gfx::PointF& extent) override;
+ virtual aura::Window* GetParentWindow() override;
+ virtual bool IsCommandIdEnabled(int command_id) override;
+ virtual void ExecuteCommand(int command_id, int event_flags) override;
+ virtual void OpenContextMenu(const gfx::PointF& point) override;
+ virtual gfx::Rect ConvertRectToScreen(const gfx::RectF& rect) const override;
+
// Overridden from aura::client::ActivationDelegate:
bool ShouldActivate() const override;
@@ -346,6 +318,10 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
void SnapToPhysicalPixelBoundary();
+ TouchSelectionControllerAura* selection_controller() {
+ return selection_controller_.get();
+ }
+
OverscrollController* overscroll_controller() const {
return overscroll_controller_.get();
}
@@ -476,6 +452,10 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
RenderFrameHostImpl* GetFocusedFrame();
+ // ...
+ void SelectionBoundsUpdated(const cc::ViewportSelectionBound& start,
+ const cc::ViewportSelectionBound& end);
+
// The model object.
RenderWidgetHostImpl* host_;
@@ -525,10 +505,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
int text_input_flags_;
bool can_compose_inline_;
- // Rectangles for the selection anchor and focus.
- gfx::Rect selection_anchor_rect_;
- gfx::Rect selection_focus_rect_;
-
// The current composition character bounds.
std::vector<gfx::Rect> composition_character_bounds_;
@@ -597,7 +573,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
bool has_snapped_to_boundary_;
- TouchEditingClient* touch_editing_client_;
+ scoped_ptr<TouchSelectionControllerAura> selection_controller_;
scoped_ptr<OverscrollController> overscroll_controller_;

Powered by Google App Engine
This is Rietveld 408576698