~osomon/oxide/override-touchUngrabEvent

« back to all changes in this revision

Viewing changes to shared/browser/oxide_render_widget_host_view.h

  • Committer: Olivier Tilloy
  • Date: 2016-01-12 11:46:34 UTC
  • mfrom: (1272.2.38 touch-selection-api)
  • Revision ID: olivier.tilloy@canonical.com-20160112114634-u1t78baa0u4hfoha
Add a touch selection API, to allow embedders to display handles for resizing the current selection, and contextual actions for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
 
// Copyright (C) 2013-2015 Canonical Ltd.
 
2
// Copyright (C) 2013-2016 Canonical Ltd.
3
3
 
4
4
// This library is free software; you can redistribute it and/or
5
5
// modify it under the terms of the GNU Lesser General Public
30
30
#include "cc/output/compositor_frame_metadata.h"
31
31
#include "content/common/cursors/webcursor.h"
32
32
#include "ui/gfx/geometry/size.h"
 
33
#include "ui/touch_selection/touch_selection_controller.h"
33
34
 
34
35
#include "shared/browser/compositor/oxide_compositor_observer.h"
35
36
#include "shared/browser/input/oxide_ime_bridge_impl.h"
48
49
 
49
50
namespace ui {
50
51
class MotionEvent;
 
52
class TouchHandleDrawable;
 
53
class TouchSelectionController;
51
54
}
52
55
 
53
56
namespace oxide {
60
63
    public GestureProviderClient,
61
64
    public RendererFrameEvictorClient,
62
65
    public cc::DelegatedFrameResourceCollectionClient,
 
66
    public ui::TouchSelectionControllerClient,
63
67
    public base::SupportsWeakPtr<RenderWidgetHostView> {
64
68
 public:
65
69
  RenderWidgetHostView(content::RenderWidgetHostImpl* render_widget_host);
73
77
    return selection_text_;
74
78
  }
75
79
 
 
80
  const gfx::Range& selection_range() const {
 
81
    return selection_range_;
 
82
  }
 
83
 
76
84
  const cc::CompositorFrameMetadata& compositor_frame_metadata() const {
77
85
    return compositor_frame_metadata_;
78
86
  }
92
100
  void Show() final;
93
101
  void Hide() final;
94
102
 
 
103
  ui::TouchSelectionController* selection_controller() const {
 
104
    return selection_controller_.get();
 
105
  }
 
106
 
95
107
 private:
96
108
  // content::RenderWidgetHostViewOxide implementation
97
109
  void OnTextInputStateChanged(ui::TextInputType type,
172
184
  // cc::DelegatedFrameResourceCollectionClient implementation
173
185
  void UnusedResourcesAreAvailable() final;
174
186
 
 
187
  // ui::TouchSelectionControllerClient implementation
 
188
  bool SupportsAnimation() const override;
 
189
  void SetNeedsAnimate() override;
 
190
  void MoveCaret(const gfx::PointF& position) override;
 
191
  void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
 
192
  void SelectBetweenCoordinates(const gfx::PointF& base,
 
193
                                const gfx::PointF& extent) override;
 
194
  void OnSelectionEvent(ui::SelectionEventType event) override;
 
195
  scoped_ptr<ui::TouchHandleDrawable> CreateDrawable() override;
 
196
 
175
197
  // ===================
176
198
 
177
199
  void UpdateCurrentCursor();
183
205
  void AttachLayer();
184
206
  void DetachLayer();
185
207
 
 
208
  bool HandleGestureForTouchSelection(const blink::WebGestureEvent& event) const;
 
209
 
186
210
  content::RenderWidgetHostImpl* host_;
187
211
 
188
212
  RenderWidgetHostViewContainer* container_;
217
241
 
218
242
  scoped_ptr<GestureProvider> gesture_provider_;
219
243
 
 
244
  scoped_ptr<ui::TouchSelectionController> selection_controller_;
 
245
 
220
246
  DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostView);
221
247
};
222
248