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

Side by Side Diff: content/browser/renderer_host/input/gesture_text_selector.h

Issue 342633003: [Android] Select text when stylus first button is pressed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed signed unsigned comparison error Created 6 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2014 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_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h"
10 #include "content/common/content_export.h"
11
12 namespace ui {
13 struct GestureEventData;
14 class MotionEvent;
15 }
16
17 namespace content {
18 class GestureTextSelectorTest;
19
20 // Interface with which GestureTextSelector can select, unselect, or show
21 // selection handles.
22 class CONTENT_EXPORT GestureTextSelectorClient {
23 public:
24 virtual ~GestureTextSelectorClient() {}
25
26 virtual void ShowSelectionHandlesAutomatically() = 0;
27 virtual void SelectRange(float x1, float y1, float x2, float y2) = 0;
28 virtual void Unselect() = 0;
29 };
30
31 // A class to handle gesture-based text selection, such as when clicking first
32 // button on stylus input.
33 class CONTENT_EXPORT GestureTextSelector {
34 public:
35 explicit GestureTextSelector(GestureTextSelectorClient* client);
36 virtual ~GestureTextSelector();
37
38 // This should be called after gesture detection but before associated
39 // gestures are dispatched. Returns whether it will consume |event|.
40 bool OnTouchEvent(const ui::MotionEvent& event);
41
42 // Returns whether it will consume the event.
43 bool OnGestureEvent(const ui::GestureEventData& gesture);
44
45 private:
46 friend class GestureTextSelectorTest;
47 FRIEND_TEST_ALL_PREFIXES(GestureTextSelectorTest,
48 ShouldStartTextSelection);
49
50 static bool ShouldStartTextSelection(const ui::MotionEvent& event);
51
52 GestureTextSelectorClient* client_;
53 bool text_selection_triggered_;
54 float anchor_x_;
55 float anchor_y_;
56
57 DISALLOW_COPY_AND_ASSIGN(GestureTextSelector);
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/input/gesture_text_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698