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

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: Created 8 years, 5 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"
19 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.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 {
(...skipping 19 matching lines...) Expand all
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
62 jboolean TouchEvent(JNIEnv* env, jobject obj, jlong time_ms, jint type,
63 jobjectArray pts);
64
65 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms,
66 jint x, jint y);
67 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
68 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms,
69 jint dx, jint dy);
70 void FlingStart(JNIEnv* env, jobject obj, jlong time_ms,
71 jint x, jint y, jint vx, jint vy);
72 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms);
73 void SingleTap(JNIEnv* env, jobject obj, jlong time_ms,
74 jint x, jint y, jboolean link_preview_tap);
75 void ShowPressState(JNIEnv* env, jobject obj, jlong time_ms,
76 jint x, jint y);
77 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms,
78 jint x, jint y) ;
79 void LongPress(JNIEnv* env, jobject obj, jlong time_ms,
80 jint x, jint y, jboolean link_preview_tap);
81 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms,
82 jint x, jint y);
83 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms);
84 void PinchBy(JNIEnv* env, jobject obj, jlong time_ms,
85 jint x, jint y, jfloat delta);
59 jboolean CanGoBack(JNIEnv* env, jobject obj); 86 jboolean CanGoBack(JNIEnv* env, jobject obj);
60 jboolean CanGoForward(JNIEnv* env, jobject obj); 87 jboolean CanGoForward(JNIEnv* env, jobject obj);
61 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); 88 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset);
62 void GoBack(JNIEnv* env, jobject obj); 89 void GoBack(JNIEnv* env, jobject obj);
63 void GoForward(JNIEnv* env, jobject obj); 90 void GoForward(JNIEnv* env, jobject obj);
64 void GoToOffset(JNIEnv* env, jobject obj, jint offset); 91 void GoToOffset(JNIEnv* env, jobject obj, jint offset);
65 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const; 92 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const;
66 void StopLoading(JNIEnv* env, jobject obj); 93 void StopLoading(JNIEnv* env, jobject obj);
67 void Reload(JNIEnv* env, jobject obj); 94 void Reload(JNIEnv* env, jobject obj);
68 jboolean NeedsReload(JNIEnv* env, jobject obj); 95 jboolean NeedsReload(JNIEnv* env, jobject obj);
69 void ClearHistory(JNIEnv* env, jobject obj); 96 void ClearHistory(JNIEnv* env, jobject obj);
70 void SetClient(JNIEnv* env, jobject obj, jobject jclient); 97 void SetClient(JNIEnv* env, jobject obj, jobject jclient);
71 98
72 // -------------------------------------------------------------------------- 99 // --------------------------------------------------------------------------
73 // Public methods that call to Java via JNI 100 // Public methods that call to Java via JNI
74 // -------------------------------------------------------------------------- 101 // --------------------------------------------------------------------------
75 102
76 // Creates a popup menu with |items|. 103 // Creates a popup menu with |items|.
77 // |multiple| defines if it should support multi-select. 104 // |multiple| defines if it should support multi-select.
78 // If not |multiple|, |selected_item| sets the initially selected item. 105 // If not |multiple|, |selected_item| sets the initially selected item.
79 // Otherwise, item's "checked" flag selects it. 106 // Otherwise, item's "checked" flag selects it.
80 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items, 107 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items,
81 int selected_item, 108 int selected_item,
82 bool multiple); 109 bool multiple);
83 110
84 void OnTabCrashed(const base::ProcessHandle handle); 111 void OnTabCrashed(const base::ProcessHandle handle);
85 void SetTitle(const string16& title); 112 void SetTitle(const string16& title);
86 113
87 bool HasFocus(); 114 bool HasFocus();
115 void ConfirmTouchEvent(bool handled) OVERRIDE;
116 void DidSetNeedTouchEvents(bool need_touch_events) OVERRIDE;
88 void OnSelectionChanged(const std::string& text); 117 void OnSelectionChanged(const std::string& text);
89 void OnSelectionBoundsChanged(int startx, 118 void OnSelectionBoundsChanged(int startx,
90 int starty, 119 int starty,
91 base::i18n::TextDirection start_dir, 120 base::i18n::TextDirection start_dir,
92 int endx, 121 int endx,
93 int endy, 122 int endy,
94 base::i18n::TextDirection end_dir); 123 base::i18n::TextDirection end_dir);
95 124
96 // Called when page loading begins. 125 // Called when page loading begins.
97 void DidStartLoading(); 126 void DidStartLoading();
(...skipping 26 matching lines...) Expand all
124 // Private methods that call to Java via JNI 153 // Private methods that call to Java via JNI
125 // -------------------------------------------------------------------------- 154 // --------------------------------------------------------------------------
126 virtual ~ContentViewCoreImpl(); 155 virtual ~ContentViewCoreImpl();
127 156
128 // -------------------------------------------------------------------------- 157 // --------------------------------------------------------------------------
129 // Other private methods and data 158 // Other private methods and data
130 // -------------------------------------------------------------------------- 159 // --------------------------------------------------------------------------
131 160
132 void InitJNI(JNIEnv* env, jobject obj); 161 void InitJNI(JNIEnv* env, jobject obj);
133 162
163 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
164
165 void SendGestureEvent(WebKit::WebInputEvent::Type type, long time_ms,
166 int x, int y,
167 float dx, float dy, bool link_preview_tap);
168
134 void PostLoadUrl(const GURL& url); 169 void PostLoadUrl(const GURL& url);
135 170
136 struct JavaObject; 171 struct JavaObject;
137 JavaObject* java_object_; 172 JavaObject* java_object_;
138 173
139 // Reference to the current WebContents used to determine how and what to 174 // Reference to the current WebContents used to determine how and what to
140 // display in the ContentViewCore. 175 // display in the ContentViewCore.
141 WebContents* web_contents_; 176 WebContents* web_contents_;
142 177
143 // We only set this to be the delegate of the web_contents if we own it. 178 // We only set this to be the delegate of the web_contents if we own it.
144 scoped_ptr<ContentViewClient> content_view_client_; 179 scoped_ptr<ContentViewClient> content_view_client_;
145 180
146 // Whether the renderer backing this ContentViewCore has crashed. 181 // Whether the renderer backing this ContentViewCore has crashed.
147 bool tab_crashed_; 182 bool tab_crashed_;
148 183
149 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); 184 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
150 }; 185 };
151 186
152 bool RegisterContentViewCore(JNIEnv* env); 187 bool RegisterContentViewCore(JNIEnv* env);
153 188
154 }; // namespace content 189 }; // namespace content
155 190
156 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 191 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698