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

Side by Side Diff: content/browser/android/content_view_core_impl.h

Issue 10790066: Enable gesture events handling on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments to avoid confusion when merging downstream Created 8 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_helper.h" 10 #include "base/android/jni_helper.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/process.h" 15 #include "base/process.h"
16 #include "content/browser/renderer_host/render_widget_host_view_android.h"
16 #include "content/public/browser/android/content_view_core.h" 17 #include "content/public/browser/android/content_view_core.h"
17 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
18 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
19 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
20 22
21 struct WebMenuItem; 23 struct WebMenuItem;
22 24
23 namespace content { 25 namespace content {
24 class ContentViewClient; 26 class ContentViewClient;
25 class RenderWidgetHostViewAndroid; 27 class RenderWidgetHostViewAndroid;
26 28
27 // TODO(jrg): this is a shell. Upstream the rest. 29 // TODO(jrg): this is a shell. Upstream the rest.
28 class ContentViewCoreImpl : public ContentViewCore, 30 class ContentViewCoreImpl : public ContentViewCore,
29 public NotificationObserver { 31 public NotificationObserver {
30 public: 32 public:
31 ContentViewCoreImpl(JNIEnv* env, 33 ContentViewCoreImpl(JNIEnv* env,
32 jobject obj, 34 jobject obj,
33 WebContents* web_contents); 35 WebContents* web_contents);
34 virtual void Destroy(JNIEnv* env, jobject obj); 36 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE;
35 37
36 // -------------------------------------------------------------------------- 38 // --------------------------------------------------------------------------
37 // Methods called from Java via JNI 39 // Methods called from Java via JNI
38 // -------------------------------------------------------------------------- 40 // --------------------------------------------------------------------------
39 41
40 // Notifies the ContentViewCore that items were selected in the currently 42 // Notifies the ContentViewCore that items were selected in the currently
41 // showing select popup. 43 // showing select popup.
42 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); 44 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices);
43 45
44 void LoadUrlWithoutUrlSanitization(JNIEnv* env, 46 void LoadUrlWithoutUrlSanitization(JNIEnv* env,
45 jobject, 47 jobject,
46 jstring jurl, 48 jstring jurl,
47 int page_transition); 49 int page_transition);
48 void LoadUrlWithoutUrlSanitizationWithUserAgentOverride( 50 void LoadUrlWithoutUrlSanitizationWithUserAgentOverride(
49 JNIEnv* env, 51 JNIEnv* env,
50 jobject, 52 jobject,
51 jstring jurl, 53 jstring jurl,
52 int page_transition, 54 int page_transition,
53 jstring user_agent_override); 55 jstring user_agent_override);
54 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; 56 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const;
55 base::android::ScopedJavaLocalRef<jstring> GetTitle( 57 base::android::ScopedJavaLocalRef<jstring> GetTitle(
56 JNIEnv* env, jobject obj) const; 58 JNIEnv* env, jobject obj) const;
57 jboolean IsIncognito(JNIEnv* env, jobject obj); 59 jboolean IsIncognito(JNIEnv* env, jobject obj);
58 jboolean Crashed(JNIEnv* env, jobject obj) const { return tab_crashed_; } 60 jboolean Crashed(JNIEnv* env, jobject obj) const { return tab_crashed_; }
61 jboolean TouchEvent(JNIEnv* env,
62 jobject obj,
63 jlong time_ms,
64 jint type,
65 jobjectArray pts);
66 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms, jint x, jint y);
67 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
68 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms, jint dx, jint dy);
69 void FlingStart(JNIEnv* env,
70 jobject obj,
71 jlong time_ms,
72 jint x,
73 jint y,
74 jint vx,
75 jint vy);
76 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms);
77 void SingleTap(JNIEnv* env,
78 jobject obj,
79 jlong time_ms,
80 jint x,
81 jint y,
82 jboolean link_preview_tap);
83 void ShowPressState(JNIEnv* env, jobject obj, jlong time_ms, jint x, jint y);
84 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms, jint x, jint y) ;
85 void LongPress(JNIEnv* env,
86 jobject obj,
87 jlong time_ms,
88 jint x,
89 jint y,
90 jboolean link_preview_tap);
91 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jint x, jint y);
92 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms);
93 void PinchBy(JNIEnv* env,
94 jobject obj,
95 jlong time_ms,
96 jint x,
97 jint y,
98 jfloat delta);
59 jboolean CanGoBack(JNIEnv* env, jobject obj); 99 jboolean CanGoBack(JNIEnv* env, jobject obj);
60 jboolean CanGoForward(JNIEnv* env, jobject obj); 100 jboolean CanGoForward(JNIEnv* env, jobject obj);
61 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); 101 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset);
62 void GoBack(JNIEnv* env, jobject obj); 102 void GoBack(JNIEnv* env, jobject obj);
63 void GoForward(JNIEnv* env, jobject obj); 103 void GoForward(JNIEnv* env, jobject obj);
64 void GoToOffset(JNIEnv* env, jobject obj, jint offset); 104 void GoToOffset(JNIEnv* env, jobject obj, jint offset);
65 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const; 105 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const;
66 void StopLoading(JNIEnv* env, jobject obj); 106 void StopLoading(JNIEnv* env, jobject obj);
67 void Reload(JNIEnv* env, jobject obj); 107 void Reload(JNIEnv* env, jobject obj);
68 jboolean NeedsReload(JNIEnv* env, jobject obj); 108 jboolean NeedsReload(JNIEnv* env, jobject obj);
69 void ClearHistory(JNIEnv* env, jobject obj); 109 void ClearHistory(JNIEnv* env, jobject obj);
70 void SetClient(JNIEnv* env, jobject obj, jobject jclient); 110 void SetClient(JNIEnv* env, jobject obj, jobject jclient);
71 111
72 // -------------------------------------------------------------------------- 112 // --------------------------------------------------------------------------
73 // Public methods that call to Java via JNI 113 // Public methods that call to Java via JNI
74 // -------------------------------------------------------------------------- 114 // --------------------------------------------------------------------------
75 115
76 // Creates a popup menu with |items|. 116 // Creates a popup menu with |items|.
77 // |multiple| defines if it should support multi-select. 117 // |multiple| defines if it should support multi-select.
78 // If not |multiple|, |selected_item| sets the initially selected item. 118 // If not |multiple|, |selected_item| sets the initially selected item.
79 // Otherwise, item's "checked" flag selects it. 119 // Otherwise, item's "checked" flag selects it.
80 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items, 120 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items,
81 int selected_item, 121 int selected_item,
82 bool multiple); 122 bool multiple);
83 123
84 void OnTabCrashed(const base::ProcessHandle handle); 124 void OnTabCrashed(const base::ProcessHandle handle);
85 void SetTitle(const string16& title); 125 void SetTitle(const string16& title);
86 126
87 bool HasFocus(); 127 bool HasFocus();
128 void ConfirmTouchEvent(bool handled);
129 void DidSetNeedTouchEvents(bool need_touch_events);
88 void OnSelectionChanged(const std::string& text); 130 void OnSelectionChanged(const std::string& text);
89 void OnSelectionBoundsChanged(int startx, 131 void OnSelectionBoundsChanged(int startx,
90 int starty, 132 int starty,
91 base::i18n::TextDirection start_dir, 133 base::i18n::TextDirection start_dir,
92 int endx, 134 int endx,
93 int endy, 135 int endy,
94 base::i18n::TextDirection end_dir); 136 base::i18n::TextDirection end_dir);
95 137
96 // Called when page loading begins. 138 // Called when page loading begins.
97 void DidStartLoading(); 139 void DidStartLoading();
(...skipping 26 matching lines...) Expand all
124 // Private methods that call to Java via JNI 166 // Private methods that call to Java via JNI
125 // -------------------------------------------------------------------------- 167 // --------------------------------------------------------------------------
126 virtual ~ContentViewCoreImpl(); 168 virtual ~ContentViewCoreImpl();
127 169
128 // -------------------------------------------------------------------------- 170 // --------------------------------------------------------------------------
129 // Other private methods and data 171 // Other private methods and data
130 // -------------------------------------------------------------------------- 172 // --------------------------------------------------------------------------
131 173
132 void InitJNI(JNIEnv* env, jobject obj); 174 void InitJNI(JNIEnv* env, jobject obj);
133 175
176 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
177
178 void SendGestureEvent(WebKit::WebInputEvent::Type type, long time_ms,
179 int x, int y,
180 float dx, float dy, bool link_preview_tap);
181
134 void PostLoadUrl(const GURL& url); 182 void PostLoadUrl(const GURL& url);
135 183
136 struct JavaObject; 184 struct JavaObject;
137 JavaObject* java_object_; 185 JavaObject* java_object_;
138 186
139 // Reference to the current WebContents used to determine how and what to 187 // Reference to the current WebContents used to determine how and what to
140 // display in the ContentViewCore. 188 // display in the ContentViewCore.
141 WebContents* web_contents_; 189 WebContents* web_contents_;
142 190
143 // We only set this to be the delegate of the web_contents if we own it. 191 // We only set this to be the delegate of the web_contents if we own it.
144 scoped_ptr<ContentViewClient> content_view_client_; 192 scoped_ptr<ContentViewClient> content_view_client_;
145 193
146 // Whether the renderer backing this ContentViewCore has crashed. 194 // Whether the renderer backing this ContentViewCore has crashed.
147 bool tab_crashed_; 195 bool tab_crashed_;
148 196
149 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); 197 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
150 }; 198 };
151 199
152 bool RegisterContentViewCore(JNIEnv* env); 200 bool RegisterContentViewCore(JNIEnv* env);
153 201
154 }; // namespace content 202 } // namespace content
155 203
156 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 204 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698