| 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/content_gesture_provider.h" | |
| 18 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 19 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 20 #include "content/public/browser/android/content_view_core.h" | 19 #include "content/public/browser/android/content_view_core.h" |
| 21 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| 24 #include "third_party/WebKit/public/web/WebInputEvent.h" | 23 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 24 #include "ui/events/gesture_detection/filtered_gesture_provider.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 ui::GestureProviderClient, |
| 41 public NotificationObserver, | 41 public NotificationObserver, |
| 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 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 // NotificationObserver implementation. | 310 // NotificationObserver implementation. |
| 311 virtual void Observe(int type, | 311 virtual void Observe(int type, |
| 312 const NotificationSource& source, | 312 const NotificationSource& source, |
| 313 const NotificationDetails& details) OVERRIDE; | 313 const NotificationDetails& details) OVERRIDE; |
| 314 | 314 |
| 315 // WebContentsObserver implementation. | 315 // WebContentsObserver implementation. |
| 316 virtual void RenderViewReady() OVERRIDE; | 316 virtual void RenderViewReady() OVERRIDE; |
| 317 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 317 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; |
| 318 | 318 |
| 319 // ContentGestureProviderClient implementation. | 319 // ui::GestureProviderClient implementation. |
| 320 virtual void OnGestureEvent(const blink::WebGestureEvent& event) OVERRIDE; | 320 virtual void OnGestureEvent(const ui::GestureEventData& gesture) OVERRIDE; |
| 321 | 321 |
| 322 // -------------------------------------------------------------------------- | 322 // -------------------------------------------------------------------------- |
| 323 // Other private methods and data | 323 // Other private methods and data |
| 324 // -------------------------------------------------------------------------- | 324 // -------------------------------------------------------------------------- |
| 325 | 325 |
| 326 void InitWebContents(); | 326 void InitWebContents(); |
| 327 | 327 |
| 328 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 328 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
| 329 | 329 |
| 330 blink::WebGestureEvent MakeGestureEvent( | 330 blink::WebGestureEvent MakeGestureEvent( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 342 // Update focus state of the RenderWidgetHostView. | 342 // Update focus state of the RenderWidgetHostView. |
| 343 void SetFocusInternal(bool focused); | 343 void SetFocusInternal(bool focused); |
| 344 | 344 |
| 345 // Send device_orientation_ to renderer. | 345 // Send device_orientation_ to renderer. |
| 346 void SendOrientationChangeEventInternal(); | 346 void SendOrientationChangeEventInternal(); |
| 347 | 347 |
| 348 // Utility method for synthesizing a touch cancel event and dispatching it | 348 // Utility method for synthesizing a touch cancel event and dispatching it |
| 349 // through the touch pipeline. | 349 // through the touch pipeline. |
| 350 void CancelActiveTouchSequenceIfNecessary(); | 350 void CancelActiveTouchSequenceIfNecessary(); |
| 351 | 351 |
| 352 float dpi_scale() const { return dpi_scale_; } |
| 353 |
| 352 // A weak reference to the Java ContentViewCore object. | 354 // A weak reference to the Java ContentViewCore object. |
| 353 JavaObjectWeakGlobalRef java_ref_; | 355 JavaObjectWeakGlobalRef java_ref_; |
| 354 | 356 |
| 355 NotificationRegistrar notification_registrar_; | 357 NotificationRegistrar notification_registrar_; |
| 356 | 358 |
| 357 // Reference to the current WebContents used to determine how and what to | 359 // Reference to the current WebContents used to determine how and what to |
| 358 // display in the ContentViewCore. | 360 // display in the ContentViewCore. |
| 359 WebContentsImpl* web_contents_; | 361 WebContentsImpl* web_contents_; |
| 360 | 362 |
| 361 // A compositor layer containing any layer that should be shown. | 363 // A compositor layer containing any layer that should be shown. |
| 362 scoped_refptr<cc::Layer> root_layer_; | 364 scoped_refptr<cc::Layer> root_layer_; |
| 363 | 365 |
| 364 // Device scale factor. | 366 // Device scale factor. |
| 365 float dpi_scale_; | 367 float dpi_scale_; |
| 366 | 368 |
| 367 // Variables used to keep track of frame timestamps and deadlines. | 369 // Variables used to keep track of frame timestamps and deadlines. |
| 368 base::TimeDelta vsync_interval_; | 370 base::TimeDelta vsync_interval_; |
| 369 base::TimeDelta expected_browser_composite_time_; | 371 base::TimeDelta expected_browser_composite_time_; |
| 370 | 372 |
| 371 // The Android view that can be used to add and remove decoration layers | 373 // The Android view that can be used to add and remove decoration layers |
| 372 // like AutofillPopup. | 374 // like AutofillPopup. |
| 373 ui::ViewAndroid* view_android_; | 375 ui::ViewAndroid* view_android_; |
| 374 | 376 |
| 375 // The owning window that has a hold of main application activity. | 377 // The owning window that has a hold of main application activity. |
| 376 ui::WindowAndroid* window_android_; | 378 ui::WindowAndroid* window_android_; |
| 377 | 379 |
| 378 // Provides gesture synthesis given a stream of touch events (derived from | 380 // Provides gesture synthesis given a stream of touch events (derived from |
| 379 // Android MotionEvent's) and touch event acks. | 381 // Android MotionEvent's) and touch event acks. |
| 380 ContentGestureProvider gesture_provider_; | 382 ui::FilteredGestureProvider gesture_provider_; |
| 381 | 383 |
| 382 // The cache of device's current orientation set from Java side, this value | 384 // The cache of device's current orientation set from Java side, this value |
| 383 // will be sent to Renderer once it is ready. | 385 // will be sent to Renderer once it is ready. |
| 384 int device_orientation_; | 386 int device_orientation_; |
| 385 | 387 |
| 386 bool geolocation_needs_pause_; | 388 bool geolocation_needs_pause_; |
| 387 | 389 |
| 388 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 390 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 389 }; | 391 }; |
| 390 | 392 |
| 391 bool RegisterContentViewCore(JNIEnv* env); | 393 bool RegisterContentViewCore(JNIEnv* env); |
| 392 | 394 |
| 393 } // namespace content | 395 } // namespace content |
| 394 | 396 |
| 395 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 397 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |