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

Side by Side Diff: content/browser/web_contents/touch_editable_impl_aura.h

Issue 12321005: Enable touch based selection and editing for webpages behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_
7
8 #include <deque>
9 #include <map>
10
11 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
12 #include "ui/aura/window_observer.h"
13 #include "ui/base/touch/touch_editing_controller.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/point.h"
16 #include "ui/gfx/rect.h"
17
18 namespace ui {
19 class Accelerator;
20 }
21
22 namespace content {
23 class TouchEditableImplAuraTest;
24
25 // Aura specific implementation of ui::TouchEditable for a RenderWidgetHostView.
26 class CONTENT_EXPORT TouchEditableImplAura
27 : public ui::TouchEditable,
28 public aura::WindowObserver,
29 public RenderWidgetHostViewAura::TouchEditingClient {
30 public:
31 virtual ~TouchEditableImplAura();
32
33 static TouchEditableImplAura* Create();
34
35 void AttachToView(RenderWidgetHostViewAura* view);
36
37 // Updates the |touch_selection_controller_| or ends touch editing session
38 // depending on the current selection and cursor state.
39 void UpdateEditingController();
40
41 // Overridden from RenderWidgetHostViewAura::TouchEditingClient.
42 virtual void StartTouchEditing() OVERRIDE;
43 virtual void EndTouchEditing() OVERRIDE;
44 virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
45 const gfx::Rect& focus) OVERRIDE;
46 virtual void OnTextInputTypeChanged(ui::TextInputType type) OVERRIDE;
47 virtual bool HandleInputEvent(const ui::Event* event) OVERRIDE;
48 virtual void GestureEventAck(int gesture_event_type) OVERRIDE;
49 virtual void OnViewDestroyed() OVERRIDE;
50
51 // Overridden from ui::TouchEditable:
52 virtual void SelectRect(const gfx::Point& start,
53 const gfx::Point& end) OVERRIDE;
54 virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE;
55 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE;
56 virtual gfx::Rect GetBounds() OVERRIDE;
57 virtual gfx::NativeView GetNativeView() OVERRIDE;
58 virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE;
59 virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE;
60 virtual bool DrawsHandles() OVERRIDE;
61 virtual void OpenContextMenu(const gfx::Point anchor) OVERRIDE;
62 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
63 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
64 virtual bool GetAcceleratorForCommandId(
65 int command_id,
66 ui::Accelerator* accelerator) OVERRIDE;
67 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
68
69 // Overridden from aura::WindowObserver.
70 virtual void OnWindowBoundsChanged(aura::Window* window,
71 const gfx::Rect& old_bounds,
72 const gfx::Rect& new_bounds) OVERRIDE;
73 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
74
75 protected:
76 TouchEditableImplAura();
77
78 private:
79 friend class TouchEditableImplAuraTest;
80
81 void Cleanup();
82
83 // Rectangles for the selection anchor and focus.
84 gfx::Rect selection_anchor_rect_;
85 gfx::Rect selection_focus_rect_;
86
87 // The current text input type.
88 ui::TextInputType text_input_type_;
89
90 RenderWidgetHostViewAura* rwhva_;
91 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_;
92
93 // True if |rwhva_| is currently handling a gesture that could result in a
94 // change in selection.
95 bool selection_gesture_in_process_;
96
97 DISALLOW_COPY_AND_ASSIGN(TouchEditableImplAura);
98 };
99
100 } // namespace content
101
102 #endif // CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698