OLD | NEW |
---|---|
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/render_widget_host_view_android.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
18 #include "content/browser/renderer_host/input/touch_to_gesture_queue.h" | |
18 #include "content/browser/web_contents/web_contents_impl.h" | 19 #include "content/browser/web_contents/web_contents_impl.h" |
19 #include "content/public/browser/android/content_view_core.h" | 20 #include "content/public/browser/android/content_view_core.h" |
20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
23 #include "third_party/WebKit/public/web/WebInputEvent.h" | 24 #include "third_party/WebKit/public/web/WebInputEvent.h" |
24 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
25 #include "ui/gfx/rect_f.h" | 26 #include "ui/gfx/rect_f.h" |
26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
27 | 28 |
28 namespace ui { | 29 namespace ui { |
29 class ViewAndroid; | 30 class ViewAndroid; |
30 class WindowAndroid; | 31 class WindowAndroid; |
31 } | 32 } |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 class RenderWidgetHostViewAndroid; | 35 class RenderWidgetHostViewAndroid; |
36 class TouchToGestureQueueClient; | |
35 struct MenuItem; | 37 struct MenuItem; |
36 | 38 |
37 // TODO(jrg): this is a shell. Upstream the rest. | 39 // TODO(jrg): this is a shell. Upstream the rest. |
38 class ContentViewCoreImpl : public ContentViewCore, | 40 class ContentViewCoreImpl : public ContentViewCore, |
39 public NotificationObserver, | 41 public NotificationObserver, |
40 public WebContentsObserver { | 42 public WebContentsObserver, |
43 public TouchToGestureQueueClient { | |
41 public: | 44 public: |
42 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 45 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
43 ContentViewCoreImpl(JNIEnv* env, | 46 ContentViewCoreImpl(JNIEnv* env, |
44 jobject obj, | 47 jobject obj, |
45 bool hardware_accelerated, | 48 bool hardware_accelerated, |
46 WebContents* web_contents, | 49 WebContents* web_contents, |
47 ui::ViewAndroid* view_android, | 50 ui::ViewAndroid* view_android, |
48 ui::WindowAndroid* window_android); | 51 ui::WindowAndroid* window_android); |
49 | 52 |
50 // ContentViewCore implementation. | 53 // ContentViewCore implementation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 jstring extra_headers, | 91 jstring extra_headers, |
89 jbyteArray post_data, | 92 jbyteArray post_data, |
90 jstring base_url_for_data_url, | 93 jstring base_url_for_data_url, |
91 jstring virtual_url_for_data_url, | 94 jstring virtual_url_for_data_url, |
92 jboolean can_load_local_resources); | 95 jboolean can_load_local_resources); |
93 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; | 96 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; |
94 base::android::ScopedJavaLocalRef<jstring> GetTitle( | 97 base::android::ScopedJavaLocalRef<jstring> GetTitle( |
95 JNIEnv* env, jobject obj) const; | 98 JNIEnv* env, jobject obj) const; |
96 jboolean IsIncognito(JNIEnv* env, jobject obj); | 99 jboolean IsIncognito(JNIEnv* env, jobject obj); |
97 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); | 100 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); |
98 jboolean SendTouchEvent(JNIEnv* env, | 101 void OnTouchEventHandlingBegin(JNIEnv* env, |
99 jobject obj, | 102 jobject obj, |
100 jlong time_ms, | 103 jlong time_ms, |
101 jint type, | 104 jint type, |
102 jobjectArray pts); | 105 jobjectArray pts); |
106 void OnTouchEventHandlingEnd(JNIEnv* env, jobject obj); | |
103 jboolean SendMouseMoveEvent(JNIEnv* env, | 107 jboolean SendMouseMoveEvent(JNIEnv* env, |
104 jobject obj, | 108 jobject obj, |
105 jlong time_ms, | 109 jlong time_ms, |
106 jfloat x, | 110 jfloat x, |
107 jfloat y); | 111 jfloat y); |
108 jboolean SendMouseWheelEvent(JNIEnv* env, | 112 jboolean SendMouseWheelEvent(JNIEnv* env, |
109 jobject obj, | 113 jobject obj, |
110 jlong time_ms, | 114 jlong time_ms, |
111 jfloat x, | 115 jfloat x, |
112 jfloat y, | 116 jfloat y, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 void UpdateImeAdapter(int native_ime_adapter, int text_input_type, | 267 void UpdateImeAdapter(int native_ime_adapter, int text_input_type, |
264 const std::string& text, | 268 const std::string& text, |
265 int selection_start, int selection_end, | 269 int selection_start, int selection_end, |
266 int composition_start, int composition_end, | 270 int composition_start, int composition_end, |
267 bool show_ime_if_needed, bool require_ack); | 271 bool show_ime_if_needed, bool require_ack); |
268 void SetTitle(const base::string16& title); | 272 void SetTitle(const base::string16& title); |
269 void OnBackgroundColorChanged(SkColor color); | 273 void OnBackgroundColorChanged(SkColor color); |
270 | 274 |
271 bool HasFocus(); | 275 bool HasFocus(); |
272 void ConfirmTouchEvent(InputEventAckState ack_result); | 276 void ConfirmTouchEvent(InputEventAckState ack_result); |
273 void UnhandledFlingStartEvent(); | 277 void UnhandledFlingStartEvent(float vx, float vy); |
274 void OnScrollUpdateGestureConsumed(); | 278 void OnScrollUpdateGestureConsumed(); |
275 void HasTouchEventHandlers(bool need_touch_events); | |
276 void OnSelectionChanged(const std::string& text); | 279 void OnSelectionChanged(const std::string& text); |
277 void OnSelectionBoundsChanged( | 280 void OnSelectionBoundsChanged( |
278 const ViewHostMsg_SelectionBounds_Params& params); | 281 const ViewHostMsg_SelectionBounds_Params& params); |
279 | 282 |
280 void StartContentIntent(const GURL& content_url); | 283 void StartContentIntent(const GURL& content_url); |
281 | 284 |
282 // Shows the disambiguation popup | 285 // Shows the disambiguation popup |
283 // |target_rect| --> window coordinates which |zoomed_bitmap| represents | 286 // |target_rect| --> window coordinates which |zoomed_bitmap| represents |
284 // |zoomed_bitmap| --> magnified image of potential touch targets | 287 // |zoomed_bitmap| --> magnified image of potential touch targets |
285 void ShowDisambiguationPopup( | 288 void ShowDisambiguationPopup( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 virtual ~ContentViewCoreImpl(); | 328 virtual ~ContentViewCoreImpl(); |
326 | 329 |
327 // NotificationObserver implementation. | 330 // NotificationObserver implementation. |
328 virtual void Observe(int type, | 331 virtual void Observe(int type, |
329 const NotificationSource& source, | 332 const NotificationSource& source, |
330 const NotificationDetails& details) OVERRIDE; | 333 const NotificationDetails& details) OVERRIDE; |
331 | 334 |
332 // WebContentsObserver implementation. | 335 // WebContentsObserver implementation. |
333 virtual void RenderViewReady() OVERRIDE; | 336 virtual void RenderViewReady() OVERRIDE; |
334 | 337 |
338 // TouchToGestureQueue implementation. | |
tdresser
2014/01/14 16:25:30
TouchToGestureQueue -> TouchToGestureQueueClient
jdduke (slow)
2014/01/14 23:24:03
Done.
| |
339 virtual void ForwardTouchEvent(const blink::WebTouchEvent& event) OVERRIDE; | |
340 virtual void ForwardGestureEvent( | |
341 const blink::WebGestureEvent& event) OVERRIDE; | |
342 | |
335 // -------------------------------------------------------------------------- | 343 // -------------------------------------------------------------------------- |
336 // Other private methods and data | 344 // Other private methods and data |
337 // -------------------------------------------------------------------------- | 345 // -------------------------------------------------------------------------- |
338 | 346 |
339 void InitWebContents(); | 347 void InitWebContents(); |
340 | 348 |
341 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 349 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
342 | 350 |
343 float GetTouchPaddingDip(); | 351 float GetTouchPaddingDip(); |
344 | 352 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 | 393 |
386 // The owning window that has a hold of main application activity. | 394 // The owning window that has a hold of main application activity. |
387 ui::WindowAndroid* window_android_; | 395 ui::WindowAndroid* window_android_; |
388 | 396 |
389 // The cache of device's current orientation set from Java side, this value | 397 // The cache of device's current orientation set from Java side, this value |
390 // will be sent to Renderer once it is ready. | 398 // will be sent to Renderer once it is ready. |
391 int device_orientation_; | 399 int device_orientation_; |
392 | 400 |
393 bool geolocation_needs_pause_; | 401 bool geolocation_needs_pause_; |
394 | 402 |
403 scoped_ptr<TouchToGestureQueue> touch_to_gesture_queue_; | |
404 | |
395 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 405 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
396 }; | 406 }; |
397 | 407 |
398 bool RegisterContentViewCore(JNIEnv* env); | 408 bool RegisterContentViewCore(JNIEnv* env); |
399 | 409 |
400 } // namespace content | 410 } // namespace content |
401 | 411 |
402 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 412 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |