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

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 // Overridden from RenderWidgetHostViewAura::TouchEditingClient.
38 virtual void StartTouchEditing() OVERRIDE;
39 virtual void EndTouchEditing() OVERRIDE;
40 virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
41 const gfx::Rect& focus) OVERRIDE;
42 virtual void OnTextInputTypeChanged(ui::TextInputType type) OVERRIDE;
43 virtual bool HandleInputEvent(const ui::Event* event) OVERRIDE;
44 virtual void GestureEventAck(int gesture_event_type) OVERRIDE;
45 virtual void OnViewDestroyed() OVERRIDE;
46
47 // Overridden from ui::TouchEditable:
48 virtual void SelectRect(const gfx::Point& start,
49 const gfx::Point& end) OVERRIDE;
50 virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE;
51 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE;
52 virtual gfx::Rect GetBounds() OVERRIDE;
53 virtual gfx::NativeView GetNativeView() OVERRIDE;
54 virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE;
55 virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE;
56 virtual bool DrawsHandles() OVERRIDE;
57 virtual void OpenContextMenu(const gfx::Point anchor) OVERRIDE;
58 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
59 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
60 virtual bool GetAcceleratorForCommandId(
61 int command_id,
62 ui::Accelerator* accelerator) OVERRIDE;
63 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
64
65 // Overridden from aura::WindowObserver.
66 virtual void OnWindowParentChanged(aura::Window* window,
67 aura::Window* parent) OVERRIDE;
68 virtual void OnWindowBoundsChanged(aura::Window* window,
69 const gfx::Rect& old_bounds,
70 const gfx::Rect& new_bounds) OVERRIDE;
71 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
72
73 protected:
74 TouchEditableImplAura();
75
76 private:
77 friend class TouchEditableImplAuraTest;
78
79 // Convenience method to update the |touch_selection_controller_| or end touch
80 // editing session depending on the current selection and cursor state.
81 void UpdateController();
82
83 void Cleanup();
84
85 // Rectangles for the selection anchor and focus.
86 gfx::Rect selection_anchor_rect_;
87 gfx::Rect selection_focus_rect_;
88
89 // The current text input type.
90 ui::TextInputType text_input_type_;
91
92 RenderWidgetHostViewAura* rwhva_;
93 aura::Window* top_level_window_;
94 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_;
95
96 // True if |rwhva_| is currently handling a gesture that could result in a
97 // change in selection.
98 bool selection_gesture_in_process_;
99
100 DISALLOW_COPY_AND_ASSIGN(TouchEditableImplAura);
101 };
102
103 } // namespace content
104
105 #endif // CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698