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/input/gesture_event_queue.h" | 17 #include "content/browser/renderer_host/input/touch_disposition_gesture_filter.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 NotificationObserver, | 40 public NotificationObserver, |
41 public WebContentsObserver, | 41 public TouchDispositionGestureFilterClient, |
42 public GestureEventQueueClient { | 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. |
52 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; | 52 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 // NotificationObserver implementation. | 329 // NotificationObserver implementation. |
330 virtual void Observe(int type, | 330 virtual void Observe(int type, |
331 const NotificationSource& source, | 331 const NotificationSource& source, |
332 const NotificationDetails& details) OVERRIDE; | 332 const NotificationDetails& details) OVERRIDE; |
333 | 333 |
334 // WebContentsObserver implementation. | 334 // WebContentsObserver implementation. |
335 virtual void RenderViewReady() OVERRIDE; | 335 virtual void RenderViewReady() OVERRIDE; |
336 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 336 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; |
337 | 337 |
338 // GestureEventQueueClient implementation. | 338 // TouchDispositionGestureFilterClient implementation. |
339 virtual void ForwardGestureEvent( | 339 virtual void ForwardGestureEvent( |
340 const blink::WebGestureEvent& event) OVERRIDE; | 340 const blink::WebGestureEvent& event) OVERRIDE; |
341 | 341 |
342 // -------------------------------------------------------------------------- | 342 // -------------------------------------------------------------------------- |
343 // Other private methods and data | 343 // Other private methods and data |
344 // -------------------------------------------------------------------------- | 344 // -------------------------------------------------------------------------- |
345 | 345 |
346 void InitWebContents(); | 346 void InitWebContents(); |
347 | 347 |
348 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 348 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 // The owning window that has a hold of main application activity. | 394 // The owning window that has a hold of main application activity. |
395 ui::WindowAndroid* window_android_; | 395 ui::WindowAndroid* window_android_; |
396 | 396 |
397 // 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 |
398 // will be sent to Renderer once it is ready. | 398 // will be sent to Renderer once it is ready. |
399 int device_orientation_; | 399 int device_orientation_; |
400 | 400 |
401 bool geolocation_needs_pause_; | 401 bool geolocation_needs_pause_; |
402 | 402 |
403 GestureEventQueue gesture_event_queue_; | 403 // Handles gesture dispatch as the generating touch events are ack'ed. |
| 404 TouchDispositionGestureFilter touch_disposition_gesture_filter_; |
404 bool handling_touch_event_; | 405 bool handling_touch_event_; |
405 blink::WebTouchEvent pending_touch_event_; | 406 blink::WebTouchEvent pending_touch_event_; |
406 GestureEventPacket pending_gesture_packet_; | 407 GestureEventPacket pending_gesture_packet_; |
407 | 408 |
408 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 409 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
409 }; | 410 }; |
410 | 411 |
411 bool RegisterContentViewCore(JNIEnv* env); | 412 bool RegisterContentViewCore(JNIEnv* env); |
412 | 413 |
413 } // namespace content | 414 } // namespace content |
414 | 415 |
415 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 416 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |