| 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/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/public/browser/android/content_view_core.h" | 19 #include "content/public/browser/android/content_view_core.h" |
| 20 #include "content/public/browser/notification_observer.h" | |
| 21 #include "content/public/browser/notification_registrar.h" | |
| 22 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 23 #include "third_party/WebKit/public/web/WebInputEvent.h" | 21 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 24 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 25 #include "ui/gfx/rect_f.h" | 23 #include "ui/gfx/rect_f.h" |
| 26 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 27 | 25 |
| 28 namespace ui { | 26 namespace ui { |
| 29 class ViewAndroid; | 27 class ViewAndroid; |
| 30 class WindowAndroid; | 28 class WindowAndroid; |
| 31 } | 29 } |
| 32 | 30 |
| 33 namespace content { | 31 namespace content { |
| 34 class RenderWidgetHostViewAndroid; | 32 class RenderWidgetHostViewAndroid; |
| 35 struct MenuItem; | 33 struct MenuItem; |
| 36 | 34 |
| 37 // TODO(jrg): this is a shell. Upstream the rest. | 35 // TODO(jrg): this is a shell. Upstream the rest. |
| 38 class ContentViewCoreImpl : public ContentViewCore, | 36 class ContentViewCoreImpl : public ContentViewCore, |
| 39 public NotificationObserver, | |
| 40 public WebContentsObserver { | 37 public WebContentsObserver { |
| 41 public: | 38 public: |
| 42 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 39 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
| 43 ContentViewCoreImpl(JNIEnv* env, | 40 ContentViewCoreImpl(JNIEnv* env, |
| 44 jobject obj, | 41 jobject obj, |
| 45 bool hardware_accelerated, | 42 bool hardware_accelerated, |
| 46 WebContents* web_contents, | 43 WebContents* web_contents, |
| 47 ui::ViewAndroid* view_android, | 44 ui::ViewAndroid* view_android, |
| 48 ui::WindowAndroid* window_android); | 45 ui::WindowAndroid* window_android); |
| 49 | 46 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 void AddBeginFrameSubscriber(); | 307 void AddBeginFrameSubscriber(); |
| 311 void RemoveBeginFrameSubscriber(); | 308 void RemoveBeginFrameSubscriber(); |
| 312 void SetNeedsAnimate(); | 309 void SetNeedsAnimate(); |
| 313 | 310 |
| 314 private: | 311 private: |
| 315 class ContentViewUserData; | 312 class ContentViewUserData; |
| 316 | 313 |
| 317 friend class ContentViewUserData; | 314 friend class ContentViewUserData; |
| 318 virtual ~ContentViewCoreImpl(); | 315 virtual ~ContentViewCoreImpl(); |
| 319 | 316 |
| 320 // NotificationObserver implementation. | |
| 321 virtual void Observe(int type, | |
| 322 const NotificationSource& source, | |
| 323 const NotificationDetails& details) OVERRIDE; | |
| 324 | |
| 325 // WebContentsObserver implementation. | 317 // WebContentsObserver implementation. |
| 326 virtual void RenderViewReady() OVERRIDE; | 318 virtual void RenderViewReady() OVERRIDE; |
| 319 virtual void RenderViewHostChanged(RenderViewHost* old_host, |
| 320 RenderViewHost* new_host) OVERRIDE; |
| 327 | 321 |
| 328 // -------------------------------------------------------------------------- | 322 // -------------------------------------------------------------------------- |
| 329 // Other private methods and data | 323 // Other private methods and data |
| 330 // -------------------------------------------------------------------------- | 324 // -------------------------------------------------------------------------- |
| 331 | 325 |
| 332 void InitWebContents(); | 326 void InitWebContents(); |
| 333 | 327 |
| 334 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 328 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
| 335 | 329 |
| 336 float GetTouchPaddingDip(); | 330 float GetTouchPaddingDip(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 349 | 343 |
| 350 // Update focus state of the RenderWidgetHostView. | 344 // Update focus state of the RenderWidgetHostView. |
| 351 void SetFocusInternal(bool focused); | 345 void SetFocusInternal(bool focused); |
| 352 | 346 |
| 353 // Send device_orientation_ to renderer. | 347 // Send device_orientation_ to renderer. |
| 354 void SendOrientationChangeEventInternal(); | 348 void SendOrientationChangeEventInternal(); |
| 355 | 349 |
| 356 // A weak reference to the Java ContentViewCore object. | 350 // A weak reference to the Java ContentViewCore object. |
| 357 JavaObjectWeakGlobalRef java_ref_; | 351 JavaObjectWeakGlobalRef java_ref_; |
| 358 | 352 |
| 359 NotificationRegistrar notification_registrar_; | |
| 360 | |
| 361 // Reference to the current WebContents used to determine how and what to | 353 // Reference to the current WebContents used to determine how and what to |
| 362 // display in the ContentViewCore. | 354 // display in the ContentViewCore. |
| 363 WebContentsImpl* web_contents_; | 355 WebContentsImpl* web_contents_; |
| 364 | 356 |
| 365 // A compositor layer containing any layer that should be shown. | 357 // A compositor layer containing any layer that should be shown. |
| 366 scoped_refptr<cc::Layer> root_layer_; | 358 scoped_refptr<cc::Layer> root_layer_; |
| 367 | 359 |
| 368 // Device scale factor. | 360 // Device scale factor. |
| 369 float dpi_scale_; | 361 float dpi_scale_; |
| 370 | 362 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 384 int device_orientation_; | 376 int device_orientation_; |
| 385 | 377 |
| 386 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 378 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 387 }; | 379 }; |
| 388 | 380 |
| 389 bool RegisterContentViewCore(JNIEnv* env); | 381 bool RegisterContentViewCore(JNIEnv* env); |
| 390 | 382 |
| 391 } // namespace content | 383 } // namespace content |
| 392 | 384 |
| 393 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 385 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |