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

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

Powered by Google App Engine
This is Rietveld 408576698