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

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: Fix type count 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 jstring extra_headers, 89 jstring extra_headers,
90 jbyteArray post_data, 90 jbyteArray post_data,
91 jstring base_url_for_data_url, 91 jstring base_url_for_data_url,
92 jstring virtual_url_for_data_url, 92 jstring virtual_url_for_data_url,
93 jboolean can_load_local_resources); 93 jboolean can_load_local_resources);
94 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; 94 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const;
95 base::android::ScopedJavaLocalRef<jstring> GetTitle( 95 base::android::ScopedJavaLocalRef<jstring> GetTitle(
96 JNIEnv* env, jobject obj) const; 96 JNIEnv* env, jobject obj) const;
97 jboolean IsIncognito(JNIEnv* env, jobject obj); 97 jboolean IsIncognito(JNIEnv* env, jobject obj);
98 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); 98 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation);
99 void OnTouchEventHandlingBegin(JNIEnv* env, 99 jboolean OnTouchEvent(JNIEnv* env,
100 jobject obj, 100 jobject obj,
101 jobject motion_event); 101 jobject motion_event);
102 void OnTouchEventHandlingEnd(JNIEnv* env, jobject obj);
103 jboolean SendMouseMoveEvent(JNIEnv* env, 102 jboolean SendMouseMoveEvent(JNIEnv* env,
104 jobject obj, 103 jobject obj,
105 jlong time_ms, 104 jlong time_ms,
106 jfloat x, 105 jfloat x,
107 jfloat y); 106 jfloat y);
108 jboolean SendMouseWheelEvent(JNIEnv* env, 107 jboolean SendMouseWheelEvent(JNIEnv* env,
109 jobject obj, 108 jobject obj,
110 jlong time_ms, 109 jlong time_ms,
111 jfloat x, 110 jfloat x,
112 jfloat y, 111 jfloat y,
113 jfloat vertical_axis); 112 jfloat vertical_axis);
114 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms, 113 void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms,
115 jfloat x, jfloat y, jfloat hintx, jfloat hinty); 114 jfloat x, jfloat y, jfloat hintx, jfloat hinty);
116 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms); 115 void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
117 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms, 116 void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms,
118 jfloat x, jfloat y, jfloat dx, jfloat dy); 117 jfloat x, jfloat y, jfloat dx, jfloat dy);
119 void FlingStart(JNIEnv* env, jobject obj, jlong time_ms, 118 void FlingStart(JNIEnv* env, jobject obj, jlong time_ms,
120 jfloat x, jfloat y, jfloat vx, jfloat vy); 119 jfloat x, jfloat y, jfloat vx, jfloat vy);
121 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms); 120 void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms);
122 void SingleTap(JNIEnv* env, jobject obj, jlong time_ms, 121 void SingleTap(JNIEnv* env, jobject obj, jlong time_ms,
123 jfloat x, jfloat y, 122 jfloat x, jfloat y,
124 jboolean disambiguation_popup_tap); 123 jboolean disambiguation_popup_tap);
125 void SingleTapUnconfirmed(JNIEnv* env, jobject obj, jlong time_ms,
126 jfloat x, jfloat y);
127 void ShowPress(JNIEnv* env, jobject obj, jlong time_ms,
128 jfloat x, jfloat y);
129 void TapCancel(JNIEnv* env, jobject obj, jlong time_ms,
130 jfloat x, jfloat y);
131 void TapDown(JNIEnv* env, jobject obj, jlong time_ms,
132 jfloat x, jfloat y);
133 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms, 124 void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms,
134 jfloat x, jfloat y) ; 125 jfloat x, jfloat y) ;
135 void LongPress(JNIEnv* env, jobject obj, jlong time_ms, 126 void LongPress(JNIEnv* env, jobject obj, jlong time_ms,
136 jfloat x, jfloat y, 127 jfloat x, jfloat y,
137 jboolean disambiguation_popup_tap); 128 jboolean disambiguation_popup_tap);
138 void LongTap(JNIEnv* env, jobject obj, jlong time_ms,
139 jfloat x, jfloat y,
140 jboolean disambiguation_popup_tap);
141 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y); 129 void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y);
142 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms); 130 void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms);
143 void PinchBy(JNIEnv* env, jobject obj, jlong time_ms, 131 void PinchBy(JNIEnv* env, jobject obj, jlong time_ms,
144 jfloat x, jfloat y, jfloat delta); 132 jfloat x, jfloat y, jfloat delta);
145 void SelectBetweenCoordinates(JNIEnv* env, jobject obj, 133 void SelectBetweenCoordinates(JNIEnv* env, jobject obj,
146 jfloat x1, jfloat y1, 134 jfloat x1, jfloat y1,
147 jfloat x2, jfloat y2); 135 jfloat x2, jfloat y2);
148 void MoveCaret(JNIEnv* env, jobject obj, jfloat x, jfloat y); 136 void MoveCaret(JNIEnv* env, jobject obj, jfloat x, jfloat y);
149 137
138 void ResetGestureDetectors(JNIEnv* env, jobject obj);
139 void IgnoreRemainingTouchEvents(JNIEnv* env, jobject obj);
140 void OnWindowFocusLost(JNIEnv* env, jobject obj);
141 void SetDoubleTapSupportForPageEnabled(JNIEnv* env,
142 jobject obj,
143 jboolean enabled);
144 void SetDoubleTapSupportEnabled(JNIEnv* env, jobject obj, jboolean enabled);
145 void SetMultiTouchZoomSupportEnabled(JNIEnv* env,
146 jobject obj,
147 jboolean enabled);
148
150 void LoadIfNecessary(JNIEnv* env, jobject obj); 149 void LoadIfNecessary(JNIEnv* env, jobject obj);
151 void RequestRestoreLoad(JNIEnv* env, jobject obj); 150 void RequestRestoreLoad(JNIEnv* env, jobject obj);
152 void StopLoading(JNIEnv* env, jobject obj); 151 void StopLoading(JNIEnv* env, jobject obj);
153 void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost); 152 void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost);
154 void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost); 153 void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost);
155 void CancelPendingReload(JNIEnv* env, jobject obj); 154 void CancelPendingReload(JNIEnv* env, jobject obj);
156 void ContinuePendingReload(JNIEnv* env, jobject obj); 155 void ContinuePendingReload(JNIEnv* env, jobject obj);
157 void ClearHistory(JNIEnv* env, jobject obj); 156 void ClearHistory(JNIEnv* env, jobject obj);
158 void EvaluateJavaScript(JNIEnv* env, 157 void EvaluateJavaScript(JNIEnv* env,
159 jobject obj, 158 jobject obj,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool animate); 208 bool animate);
210 void ShowImeIfNeeded(JNIEnv* env, jobject obj); 209 void ShowImeIfNeeded(JNIEnv* env, jobject obj);
211 210
212 void ShowInterstitialPage(JNIEnv* env, 211 void ShowInterstitialPage(JNIEnv* env,
213 jobject obj, 212 jobject obj,
214 jstring jurl, 213 jstring jurl,
215 jint delegate); 214 jint delegate);
216 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); 215 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj);
217 216
218 void SetAccessibilityEnabled(JNIEnv* env, jobject obj, bool enabled); 217 void SetAccessibilityEnabled(JNIEnv* env, jobject obj, bool enabled);
219 void SendActionAfterDoubleTapUma(JNIEnv* env,
220 jobject obj,
221 jint type,
222 jboolean has_delay,
223 jint count);
224 void SendSingleTapUma(JNIEnv* env, jobject obj, jint type, jint count);
225 218
226 void ExtractSmartClipData(JNIEnv* env, 219 void ExtractSmartClipData(JNIEnv* env,
227 jobject obj, 220 jobject obj,
228 jint x, 221 jint x,
229 jint y, 222 jint y,
230 jint width, 223 jint width,
231 jint height); 224 jint height);
232 // -------------------------------------------------------------------------- 225 // --------------------------------------------------------------------------
233 // Public methods that call to Java via JNI 226 // Public methods that call to Java via JNI
234 // -------------------------------------------------------------------------- 227 // --------------------------------------------------------------------------
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 311
319 // NotificationObserver implementation. 312 // NotificationObserver implementation.
320 virtual void Observe(int type, 313 virtual void Observe(int type,
321 const NotificationSource& source, 314 const NotificationSource& source,
322 const NotificationDetails& details) OVERRIDE; 315 const NotificationDetails& details) OVERRIDE;
323 316
324 // WebContentsObserver implementation. 317 // WebContentsObserver implementation.
325 virtual void RenderViewReady() OVERRIDE; 318 virtual void RenderViewReady() OVERRIDE;
326 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; 319 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
327 320
328 // TouchDispositionGestureFilterClient implementation. 321 // ContentGestureProviderClient implementation.
329 virtual void ForwardGestureEvent( 322 virtual void OnGestureEvent(const blink::WebGestureEvent& event) OVERRIDE;
330 const blink::WebGestureEvent& event) OVERRIDE;
331 323
332 // -------------------------------------------------------------------------- 324 // --------------------------------------------------------------------------
333 // Other private methods and data 325 // Other private methods and data
334 // -------------------------------------------------------------------------- 326 // --------------------------------------------------------------------------
335 327
336 void InitWebContents(); 328 void InitWebContents();
337 329
338 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); 330 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
339 331
340 float GetTouchPaddingDip(); 332 float GetTouchPaddingDip();
341 333
342 blink::WebGestureEvent MakeGestureEvent( 334 blink::WebGestureEvent MakeGestureEvent(
343 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const; 335 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const;
344 336
345 void SendBeginFrame(base::TimeTicks frame_time); 337 void SendBeginFrame(base::TimeTicks frame_time);
346 338
347 gfx::Size GetViewportSizePix() const; 339 gfx::Size GetViewportSizePix() const;
348 gfx::Size GetViewportSizeOffsetPix() const; 340 gfx::Size GetViewportSizeOffsetPix() const;
349 341
350 void DeleteScaledSnapshotTexture(); 342 void DeleteScaledSnapshotTexture();
351 343
352 void SendGestureEvent(const blink::WebGestureEvent& event); 344 void SendGestureEvent(const blink::WebGestureEvent& event);
353 void SendSyntheticGestureEvent(const blink::WebGestureEvent& event);
354 345
355 // Update focus state of the RenderWidgetHostView. 346 // Update focus state of the RenderWidgetHostView.
356 void SetFocusInternal(bool focused); 347 void SetFocusInternal(bool focused);
357 348
358 // Send device_orientation_ to renderer. 349 // Send device_orientation_ to renderer.
359 void SendOrientationChangeEventInternal(); 350 void SendOrientationChangeEventInternal();
360 351
361 // A weak reference to the Java ContentViewCore object. 352 // A weak reference to the Java ContentViewCore object.
362 JavaObjectWeakGlobalRef java_ref_; 353 JavaObjectWeakGlobalRef java_ref_;
363 354
(...skipping 13 matching lines...) Expand all
377 base::TimeDelta vsync_interval_; 368 base::TimeDelta vsync_interval_;
378 base::TimeDelta expected_browser_composite_time_; 369 base::TimeDelta expected_browser_composite_time_;
379 370
380 // The Android view that can be used to add and remove decoration layers 371 // The Android view that can be used to add and remove decoration layers
381 // like AutofillPopup. 372 // like AutofillPopup.
382 ui::ViewAndroid* view_android_; 373 ui::ViewAndroid* view_android_;
383 374
384 // The owning window that has a hold of main application activity. 375 // The owning window that has a hold of main application activity.
385 ui::WindowAndroid* window_android_; 376 ui::WindowAndroid* window_android_;
386 377
378 // Provides gesture synthesis given a stream of touch events (derived from
379 // Android MotionEvent's) and touch event acks.
380 ContentGestureProvider gesture_provider_;
381
387 // The cache of device's current orientation set from Java side, this value 382 // The cache of device's current orientation set from Java side, this value
388 // will be sent to Renderer once it is ready. 383 // will be sent to Renderer once it is ready.
389 int device_orientation_; 384 int device_orientation_;
390 385
391 bool geolocation_needs_pause_; 386 bool geolocation_needs_pause_;
392 387
393 // Handles gesture dispatch as the generating touch events are ack'ed.
394 TouchDispositionGestureFilter touch_disposition_gesture_filter_;
395 bool handling_touch_event_;
396 blink::WebTouchEvent pending_touch_event_;
397 GestureEventPacket pending_gesture_packet_;
398
399 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); 388 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
400 }; 389 };
401 390
402 bool RegisterContentViewCore(JNIEnv* env); 391 bool RegisterContentViewCore(JNIEnv* env);
403 392
404 } // namespace content 393 } // namespace content
405 394
406 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 395 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/content_view_core_impl.cc » ('j') | content/browser/android/content_view_core_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698