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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class ContentViewCoreImpl : public ContentViewCore, | 44 class ContentViewCoreImpl : public ContentViewCore, |
45 public ui::OverscrollRefreshHandler, | 45 public ui::OverscrollRefreshHandler, |
46 public WebContentsObserver { | 46 public WebContentsObserver { |
47 public: | 47 public: |
48 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 48 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
49 ContentViewCoreImpl( | 49 ContentViewCoreImpl( |
50 JNIEnv* env, | 50 JNIEnv* env, |
51 const base::android::JavaRef<jobject>& obj, | 51 const base::android::JavaRef<jobject>& obj, |
52 WebContents* web_contents, | 52 WebContents* web_contents, |
| 53 float dpi_scale, |
53 const base::android::JavaRef<jobject>& java_bridge_retained_object_set); | 54 const base::android::JavaRef<jobject>& java_bridge_retained_object_set); |
54 | 55 |
55 // ContentViewCore implementation. | 56 // ContentViewCore implementation. |
56 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 57 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
57 WebContents* GetWebContents() const override; | 58 WebContents* GetWebContents() const override; |
58 ui::WindowAndroid* GetWindowAndroid() const override; | 59 ui::WindowAndroid* GetWindowAndroid() const override; |
59 void ShowPastePopup(int x, int y) override; | 60 void ShowPastePopup(int x, int y) override; |
60 | 61 |
61 void AddObserver(ContentViewCoreImplObserver* observer); | 62 void AddObserver(ContentViewCoreImplObserver* observer); |
62 void RemoveObserver(ContentViewCoreImplObserver* observer); | 63 void RemoveObserver(ContentViewCoreImplObserver* observer); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 JNIEnv* env, | 211 JNIEnv* env, |
211 const base::android::JavaParamRef<jobject>& obj, | 212 const base::android::JavaParamRef<jobject>& obj, |
212 jboolean enabled); | 213 jboolean enabled); |
213 | 214 |
214 long GetNativeImeAdapter(JNIEnv* env, | 215 long GetNativeImeAdapter(JNIEnv* env, |
215 const base::android::JavaParamRef<jobject>& obj); | 216 const base::android::JavaParamRef<jobject>& obj); |
216 void SetFocus(JNIEnv* env, | 217 void SetFocus(JNIEnv* env, |
217 const base::android::JavaParamRef<jobject>& obj, | 218 const base::android::JavaParamRef<jobject>& obj, |
218 jboolean focused); | 219 jboolean focused); |
219 | 220 |
| 221 void SetDIPScale(JNIEnv* env, |
| 222 const base::android::JavaParamRef<jobject>& obj, |
| 223 jfloat dipScale); |
| 224 |
220 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 225 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
221 void SetAllowJavascriptInterfacesInspection( | 226 void SetAllowJavascriptInterfacesInspection( |
222 JNIEnv* env, | 227 JNIEnv* env, |
223 const base::android::JavaParamRef<jobject>& obj, | 228 const base::android::JavaParamRef<jobject>& obj, |
224 jboolean allow); | 229 jboolean allow); |
225 void AddJavascriptInterface( | 230 void AddJavascriptInterface( |
226 JNIEnv* env, | 231 JNIEnv* env, |
227 const base::android::JavaParamRef<jobject>& obj, | 232 const base::android::JavaParamRef<jobject>& obj, |
228 const base::android::JavaParamRef<jobject>& object, | 233 const base::android::JavaParamRef<jobject>& object, |
229 const base::android::JavaParamRef<jstring>& name, | 234 const base::android::JavaParamRef<jstring>& name, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 bool PullStart() override; | 405 bool PullStart() override; |
401 void PullUpdate(float delta) override; | 406 void PullUpdate(float delta) override; |
402 void PullRelease(bool allow_refresh) override; | 407 void PullRelease(bool allow_refresh) override; |
403 void PullReset() override; | 408 void PullReset() override; |
404 | 409 |
405 // -------------------------------------------------------------------------- | 410 // -------------------------------------------------------------------------- |
406 // Other private methods and data | 411 // Other private methods and data |
407 // -------------------------------------------------------------------------- | 412 // -------------------------------------------------------------------------- |
408 | 413 |
409 void InitWebContents(); | 414 void InitWebContents(); |
| 415 void SendScreenRectsAndResizeWidget(); |
410 | 416 |
411 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; | 417 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; |
412 | 418 |
413 blink::WebGestureEvent MakeGestureEvent(blink::WebInputEvent::Type type, | 419 blink::WebGestureEvent MakeGestureEvent(blink::WebInputEvent::Type type, |
414 int64_t time_ms, | 420 int64_t time_ms, |
415 float x, | 421 float x, |
416 float y) const; | 422 float y) const; |
417 | 423 |
418 gfx::Size GetViewportSizePix() const; | 424 gfx::Size GetViewportSizePix() const; |
419 int GetTopControlsHeightPix() const; | 425 int GetTopControlsHeightPix() const; |
(...skipping 16 matching lines...) Expand all Loading... |
436 ui::ViewAndroid::ScopedAnchorView select_popup_; | 442 ui::ViewAndroid::ScopedAnchorView select_popup_; |
437 | 443 |
438 // Reference to the current WebContents used to determine how and what to | 444 // Reference to the current WebContents used to determine how and what to |
439 // display in the ContentViewCore. | 445 // display in the ContentViewCore. |
440 WebContentsImpl* web_contents_; | 446 WebContentsImpl* web_contents_; |
441 | 447 |
442 // Page scale factor. | 448 // Page scale factor. |
443 float page_scale_; | 449 float page_scale_; |
444 | 450 |
445 // Device scale factor. | 451 // Device scale factor. |
446 const float dpi_scale_; | 452 float dpi_scale_; |
447 | 453 |
448 // Observer to notify of lifecyle changes. | 454 // Observer to notify of lifecyle changes. |
449 base::ObserverList<ContentViewCoreImplObserver> observer_list_; | 455 base::ObserverList<ContentViewCoreImplObserver> observer_list_; |
450 | 456 |
451 // The cache of device's current orientation set from Java side, this value | 457 // The cache of device's current orientation set from Java side, this value |
452 // will be sent to Renderer once it is ready. | 458 // will be sent to Renderer once it is ready. |
453 int device_orientation_; | 459 int device_orientation_; |
454 | 460 |
455 bool accessibility_enabled_; | 461 bool accessibility_enabled_; |
456 | 462 |
457 // Manages injecting Java objects. | 463 // Manages injecting Java objects. |
458 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; | 464 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; |
459 | 465 |
460 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 466 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
461 }; | 467 }; |
462 | 468 |
463 bool RegisterContentViewCore(JNIEnv* env); | 469 bool RegisterContentViewCore(JNIEnv* env); |
464 | 470 |
465 } // namespace content | 471 } // namespace content |
466 | 472 |
467 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 473 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |