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

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

Issue 181833003: [Android] Out with the Android GR, in with the new unified C++ GR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_helper.h" 11 #include "base/android/jni_helper.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "content/browser/renderer_host/input/touch_disposition_gesture_filter.h " 17 #include "content/browser/renderer_host/input/content_gesture_provider.h"
18 #include "content/browser/renderer_host/render_widget_host_view_android.h" 18 #include "content/browser/renderer_host/render_widget_host_view_android.h"
19 #include "content/browser/web_contents/web_contents_impl.h" 19 #include "content/browser/web_contents/web_contents_impl.h"
20 #include "content/public/browser/android/content_view_core.h" 20 #include "content/public/browser/android/content_view_core.h"
21 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
24 #include "third_party/WebKit/public/web/WebInputEvent.h" 24 #include "third_party/WebKit/public/web/WebInputEvent.h"
25 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
26 #include "ui/gfx/rect_f.h" 26 #include "ui/gfx/rect_f.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 namespace ui { 29 namespace ui {
30 class ViewAndroid; 30 class ViewAndroid;
31 class WindowAndroid; 31 class WindowAndroid;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 class RenderWidgetHostViewAndroid; 35 class RenderWidgetHostViewAndroid;
36 struct MenuItem; 36 struct MenuItem;
37 37
38 // TODO(jrg): this is a shell. Upstream the rest. 38 // TODO(jrg): this is a shell. Upstream the rest.
39 class ContentViewCoreImpl : public ContentViewCore, 39 class ContentViewCoreImpl : public ContentViewCore,
40 public ContentGestureProviderClient,
40 public NotificationObserver, 41 public NotificationObserver,
41 public TouchDispositionGestureFilterClient,
42 public WebContentsObserver { 42 public WebContentsObserver {
43 public: 43 public:
44 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); 44 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents);
45 ContentViewCoreImpl(JNIEnv* env, 45 ContentViewCoreImpl(JNIEnv* env,
46 jobject obj, 46 jobject obj,
47 WebContents* web_contents, 47 WebContents* web_contents,
48 ui::ViewAndroid* view_android, 48 ui::ViewAndroid* view_android,
49 ui::WindowAndroid* window_android); 49 ui::WindowAndroid* window_android);
50 50
51 // ContentViewCore implementation. 51 // ContentViewCore implementation.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 jstring extra_headers, 87 jstring extra_headers,
88 jbyteArray post_data, 88 jbyteArray post_data,
89 jstring base_url_for_data_url, 89 jstring base_url_for_data_url,
90 jstring virtual_url_for_data_url, 90 jstring virtual_url_for_data_url,
91 jboolean can_load_local_resources); 91 jboolean can_load_local_resources);
92 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; 92 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const;
93 base::android::ScopedJavaLocalRef<jstring> GetTitle( 93 base::android::ScopedJavaLocalRef<jstring> GetTitle(
94 JNIEnv* env, jobject obj) const; 94 JNIEnv* env, jobject obj) const;
95 jboolean IsIncognito(JNIEnv* env, jobject obj); 95 jboolean IsIncognito(JNIEnv* env, jobject obj);
96 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); 96 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation);
97 void OnTouchEventHandlingBegin(JNIEnv* env, 97 jboolean OnTouchEvent(JNIEnv* env,
98 jobject obj, 98 jobject obj,
99 jobject motion_event); 99 jobject motion_event);
100 void OnTouchEventHandlingEnd(JNIEnv* env, jobject obj);
101 jboolean SendMouseMoveEvent(JNIEnv* env, 100 jboolean SendMouseMoveEvent(JNIEnv* env,
102 jobject obj, 101 jobject obj,
103 jlong time_ms, 102 jlong time_ms,
104 jfloat x, 103 jfloat x,
105 jfloat y); 104 jfloat y);
106 jboolean SendMouseWheelEvent(JNIEnv* env, 105 jboolean SendMouseWheelEvent(JNIEnv* env,
107 jobject obj, 106 jobject obj,
108 jlong time_ms, 107 jlong time_ms,
109 jfloat x, 108 jfloat x,
110 jfloat y, 109 jfloat y,
111 jfloat vertical_axis); 110 jfloat vertical_axis);
112 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms, 111 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms,
113 jfloat x, jfloat y, jfloat hintx, jfloat hinty); 112 jfloat x, jfloat y, jfloat hintx, jfloat hinty);
114 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms); 113 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
115 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms, 114 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms,
116 jfloat x, jfloat y, jfloat dx, jfloat dy); 115 jfloat x, jfloat y, jfloat dx, jfloat dy);
117 void FlingStart(JNIEnv* env, jobject obj, jlong time_ms, 116 void FlingStart(JNIEnv* env, jobject obj, jlong time_ms,
118 jfloat x, jfloat y, jfloat vx, jfloat vy); 117 jfloat x, jfloat y, jfloat vx, jfloat vy);
119 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms); 118 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms);
120 void SingleTap(JNIEnv* env, jobject obj, jlong time_ms, 119 void SingleTap(JNIEnv* env, jobject obj, jlong time_ms,
121 jfloat x, jfloat y, 120 jfloat x, jfloat y,
122 jboolean disambiguation_popup_tap); 121 jboolean disambiguation_popup_tap);
123 void SingleTapUnconfirmed(JNIEnv* env, jobject obj, jlong time_ms,
124 jfloat x, jfloat y);
125 void ShowPress(JNIEnv* env, jobject obj, jlong time_ms,
126 jfloat x, jfloat y);
127 void TapCancel(JNIEnv* env, jobject obj, jlong time_ms,
128 jfloat x, jfloat y);
129 void TapDown(JNIEnv* env, jobject obj, jlong time_ms,
130 jfloat x, jfloat y);
131 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms, 122 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms,
132 jfloat x, jfloat y) ; 123 jfloat x, jfloat y) ;
133 void LongPress(JNIEnv* env, jobject obj, jlong time_ms, 124 void LongPress(JNIEnv* env, jobject obj, jlong time_ms,
134 jfloat x, jfloat y, 125 jfloat x, jfloat y,
135 jboolean disambiguation_popup_tap); 126 jboolean disambiguation_popup_tap);
136 void LongTap(JNIEnv* env, jobject obj, jlong time_ms,
137 jfloat x, jfloat y,
138 jboolean disambiguation_popup_tap);
139 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y); 127 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y);
140 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms); 128 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms);
141 void PinchBy(JNIEnv* env, jobject obj, jlong time_ms, 129 void PinchBy(JNIEnv* env, jobject obj, jlong time_ms,
142 jfloat x, jfloat y, jfloat delta); 130 jfloat x, jfloat y, jfloat delta);
143 void SelectBetweenCoordinates(JNIEnv* env, jobject obj, 131 void SelectBetweenCoordinates(JNIEnv* env, jobject obj,
144 jfloat x1, jfloat y1, 132 jfloat x1, jfloat y1,
145 jfloat x2, jfloat y2); 133 jfloat x2, jfloat y2);
146 void MoveCaret(JNIEnv* env, jobject obj, jfloat x, jfloat y); 134 void MoveCaret(JNIEnv* env, jobject obj, jfloat x, jfloat y);
147 135
136 void ResetGestureDetectors(JNIEnv* env, jobject obj);
137 void IgnoreRemainingTouchEvents(JNIEnv* env, jobject obj);
138 void OnWindowFocusLost(JNIEnv* env, jobject obj);
139 void UpdateDoubleTapSupportForPage(JNIEnv* env,
140 jobject obj,
141 jboolean has_support);
142 void UpdateDoubleTapSupport(JNIEnv* env, jobject obj, jboolean has_support);
143 void UpdateMultiTouchZoomSupport(JNIEnv* env,
144 jobject obj,
145 jboolean has_support);
146
148 void LoadIfNecessary(JNIEnv* env, jobject obj); 147 void LoadIfNecessary(JNIEnv* env, jobject obj);
149 void RequestRestoreLoad(JNIEnv* env, jobject obj); 148 void RequestRestoreLoad(JNIEnv* env, jobject obj);
150 void StopLoading(JNIEnv* env, jobject obj); 149 void StopLoading(JNIEnv* env, jobject obj);
151 void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost); 150 void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost);
152 void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost); 151 void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost);
153 void CancelPendingReload(JNIEnv* env, jobject obj); 152 void CancelPendingReload(JNIEnv* env, jobject obj);
154 void ContinuePendingReload(JNIEnv* env, jobject obj); 153 void ContinuePendingReload(JNIEnv* env, jobject obj);
155 void ClearHistory(JNIEnv* env, jobject obj); 154 void ClearHistory(JNIEnv* env, jobject obj);
156 void EvaluateJavaScript(JNIEnv* env, 155 void EvaluateJavaScript(JNIEnv* env,
157 jobject obj, 156 jobject obj,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool animate); 209 bool animate);
211 void ShowImeIfNeeded(JNIEnv* env, jobject obj); 210 void ShowImeIfNeeded(JNIEnv* env, jobject obj);
212 211
213 void ShowInterstitialPage(JNIEnv* env, 212 void ShowInterstitialPage(JNIEnv* env,
214 jobject obj, 213 jobject obj,
215 jstring jurl, 214 jstring jurl,
216 jint delegate); 215 jint delegate);
217 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); 216 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj);
218 217
219 void SetAccessibilityEnabled(JNIEnv* env, jobject obj, bool enabled); 218 void SetAccessibilityEnabled(JNIEnv* env, jobject obj, bool enabled);
220 void SendActionAfterDoubleTapUma(JNIEnv* env,
221 jobject obj,
222 jint type,
223 jboolean has_delay,
224 jint count);
225 void SendSingleTapUma(JNIEnv* env, jobject obj, jint type, jint count);
226 219
227 void ExtractSmartClipData(JNIEnv* env, 220 void ExtractSmartClipData(JNIEnv* env,
228 jobject obj, 221 jobject obj,
229 jint x, 222 jint x,
230 jint y, 223 jint y,
231 jint width, 224 jint width,
232 jint height); 225 jint height);
233 // -------------------------------------------------------------------------- 226 // --------------------------------------------------------------------------
234 // Public methods that call to Java via JNI 227 // Public methods that call to Java via JNI
235 // -------------------------------------------------------------------------- 228 // --------------------------------------------------------------------------
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 312
320 // NotificationObserver implementation. 313 // NotificationObserver implementation.
321 virtual void Observe(int type, 314 virtual void Observe(int type,
322 const NotificationSource& source, 315 const NotificationSource& source,
323 const NotificationDetails& details) OVERRIDE; 316 const NotificationDetails& details) OVERRIDE;
324 317
325 // WebContentsObserver implementation. 318 // WebContentsObserver implementation.
326 virtual void RenderViewReady() OVERRIDE; 319 virtual void RenderViewReady() OVERRIDE;
327 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; 320 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
328 321
329 // TouchDispositionGestureFilterClient implementation. 322 // ContentGestureProviderClient implementation.
330 virtual void ForwardGestureEvent( 323 virtual void OnGestureEvent(const blink::WebGestureEvent& event) OVERRIDE;
331 const blink::WebGestureEvent& event) OVERRIDE;
332 324
333 // -------------------------------------------------------------------------- 325 // --------------------------------------------------------------------------
334 // Other private methods and data 326 // Other private methods and data
335 // -------------------------------------------------------------------------- 327 // --------------------------------------------------------------------------
336 328
337 void InitWebContents(); 329 void InitWebContents();
338 330
339 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); 331 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
340 332
341 float GetTouchPaddingDip(); 333 float GetTouchPaddingDip();
342 334
343 blink::WebGestureEvent MakeGestureEvent( 335 blink::WebGestureEvent MakeGestureEvent(
344 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const; 336 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const;
345 337
346 void SendBeginFrame(base::TimeTicks frame_time); 338 void SendBeginFrame(base::TimeTicks frame_time);
347 339
348 gfx::Size GetViewportSizePix() const; 340 gfx::Size GetViewportSizePix() const;
349 gfx::Size GetViewportSizeOffsetPix() const; 341 gfx::Size GetViewportSizeOffsetPix() const;
350 342
351 void DeleteScaledSnapshotTexture(); 343 void DeleteScaledSnapshotTexture();
352 344
353 void SendGestureEvent(const blink::WebGestureEvent& event); 345 void SendGestureEvent(const blink::WebGestureEvent& event);
354 void SendSyntheticGestureEvent(const blink::WebGestureEvent& event);
355 346
356 // Update focus state of the RenderWidgetHostView. 347 // Update focus state of the RenderWidgetHostView.
357 void SetFocusInternal(bool focused); 348 void SetFocusInternal(bool focused);
358 349
359 // Send device_orientation_ to renderer. 350 // Send device_orientation_ to renderer.
360 void SendOrientationChangeEventInternal(); 351 void SendOrientationChangeEventInternal();
361 352
362 // A weak reference to the Java ContentViewCore object. 353 // A weak reference to the Java ContentViewCore object.
363 JavaObjectWeakGlobalRef java_ref_; 354 JavaObjectWeakGlobalRef java_ref_;
364 355
(...skipping 13 matching lines...) Expand all
378 base::TimeDelta vsync_interval_; 369 base::TimeDelta vsync_interval_;
379 base::TimeDelta expected_browser_composite_time_; 370 base::TimeDelta expected_browser_composite_time_;
380 371
381 // The Android view that can be used to add and remove decoration layers 372 // The Android view that can be used to add and remove decoration layers
382 // like AutofillPopup. 373 // like AutofillPopup.
383 ui::ViewAndroid* view_android_; 374 ui::ViewAndroid* view_android_;
384 375
385 // The owning window that has a hold of main application activity. 376 // The owning window that has a hold of main application activity.
386 ui::WindowAndroid* window_android_; 377 ui::WindowAndroid* window_android_;
387 378
379 // Provides gesture synthesis given a stream of touch events (derived from
380 // Android MotionEvent's) and touch event acks.
381 ContentGestureProvider gesture_provider_;
382
388 // The cache of device's current orientation set from Java side, this value 383 // The cache of device's current orientation set from Java side, this value
389 // will be sent to Renderer once it is ready. 384 // will be sent to Renderer once it is ready.
390 int device_orientation_; 385 int device_orientation_;
391 386
392 bool geolocation_needs_pause_; 387 bool geolocation_needs_pause_;
393 388
394 // Handles gesture dispatch as the generating touch events are ack'ed.
395 TouchDispositionGestureFilter touch_disposition_gesture_filter_;
396 bool handling_touch_event_;
397 blink::WebTouchEvent pending_touch_event_;
398 GestureEventPacket pending_gesture_packet_;
399
400 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); 389 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
401 }; 390 };
402 391
403 bool RegisterContentViewCore(JNIEnv* env); 392 bool RegisterContentViewCore(JNIEnv* env);
404 393
405 } // namespace content 394 } // namespace content
406 395
407 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 396 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698