| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 struct MenuItem; | 42 struct MenuItem; |
| 43 | 43 |
| 44 class ContentViewCoreImpl : public ContentViewCore, | 44 class ContentViewCoreImpl : public ContentViewCore, |
| 45 public WebContentsObserver { | 45 public WebContentsObserver { |
| 46 public: | 46 public: |
| 47 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 47 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
| 48 ContentViewCoreImpl( | 48 ContentViewCoreImpl( |
| 49 JNIEnv* env, | 49 JNIEnv* env, |
| 50 const base::android::JavaRef<jobject>& obj, | 50 const base::android::JavaRef<jobject>& obj, |
| 51 WebContents* web_contents, | 51 WebContents* web_contents, |
| 52 ImeAdapterAndroid* ime_adapter, |
| 52 float dpi_scale, | 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 bool ShowPastePopup(const ContextMenuParams& params) override; | 60 bool ShowPastePopup(const ContextMenuParams& params) override; |
| 60 | 61 |
| 61 void AddObserver(ContentViewCoreImplObserver* observer); | 62 void AddObserver(ContentViewCoreImplObserver* observer); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const base::android::JavaParamRef<jobject>& obj); | 167 const base::android::JavaParamRef<jobject>& obj); |
| 167 void SetDoubleTapSupportEnabled( | 168 void SetDoubleTapSupportEnabled( |
| 168 JNIEnv* env, | 169 JNIEnv* env, |
| 169 const base::android::JavaParamRef<jobject>& obj, | 170 const base::android::JavaParamRef<jobject>& obj, |
| 170 jboolean enabled); | 171 jboolean enabled); |
| 171 void SetMultiTouchZoomSupportEnabled( | 172 void SetMultiTouchZoomSupportEnabled( |
| 172 JNIEnv* env, | 173 JNIEnv* env, |
| 173 const base::android::JavaParamRef<jobject>& obj, | 174 const base::android::JavaParamRef<jobject>& obj, |
| 174 jboolean enabled); | 175 jboolean enabled); |
| 175 | 176 |
| 176 long GetNativeImeAdapter(JNIEnv* env, | |
| 177 const base::android::JavaParamRef<jobject>& obj); | |
| 178 void SetFocus(JNIEnv* env, | 177 void SetFocus(JNIEnv* env, |
| 179 const base::android::JavaParamRef<jobject>& obj, | 178 const base::android::JavaParamRef<jobject>& obj, |
| 180 jboolean focused); | 179 jboolean focused); |
| 181 | 180 |
| 182 void SetDIPScale(JNIEnv* env, | 181 void SetDIPScale(JNIEnv* env, |
| 183 const base::android::JavaParamRef<jobject>& obj, | 182 const base::android::JavaParamRef<jobject>& obj, |
| 184 jfloat dipScale); | 183 jfloat dipScale); |
| 185 | 184 |
| 186 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 185 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
| 187 void SetAllowJavascriptInterfacesInspection( | 186 void SetAllowJavascriptInterfacesInspection( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, | 259 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, |
| 261 float page_scale_factor, | 260 float page_scale_factor, |
| 262 const gfx::Vector2dF& page_scale_factor_limits, | 261 const gfx::Vector2dF& page_scale_factor_limits, |
| 263 const gfx::SizeF& content_size, | 262 const gfx::SizeF& content_size, |
| 264 const gfx::SizeF& viewport_size, | 263 const gfx::SizeF& viewport_size, |
| 265 const float top_controls_height, | 264 const float top_controls_height, |
| 266 const float top_controls_shown_ratio, | 265 const float top_controls_shown_ratio, |
| 267 bool is_mobile_optimized_hint, | 266 bool is_mobile_optimized_hint, |
| 268 const gfx::SelectionBound& selection_start); | 267 const gfx::SelectionBound& selection_start); |
| 269 | 268 |
| 270 void ForceUpdateImeAdapter(long native_ime_adapter); | 269 void UpdateImeAdapter(int text_input_type, |
| 271 void UpdateImeAdapter(long native_ime_adapter, | |
| 272 int text_input_type, | |
| 273 int text_input_flags, | 270 int text_input_flags, |
| 274 int text_input_mode, | 271 int text_input_mode, |
| 275 const std::string& text, | 272 const std::string& text, |
| 276 int selection_start, | 273 int selection_start, |
| 277 int selection_end, | 274 int selection_end, |
| 278 int composition_start, | 275 int composition_start, |
| 279 int composition_end, | 276 int composition_end, |
| 280 bool show_ime_if_needed, | 277 bool show_ime_if_needed, |
| 281 bool reply_to_request); | 278 bool reply_to_request); |
| 282 | 279 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 float GetBottomControlsHeightDip() const; | 323 float GetBottomControlsHeightDip() const; |
| 327 | 324 |
| 328 void MoveRangeSelectionExtent(const gfx::PointF& extent); | 325 void MoveRangeSelectionExtent(const gfx::PointF& extent); |
| 329 | 326 |
| 330 void SelectBetweenCoordinates(const gfx::PointF& base, | 327 void SelectBetweenCoordinates(const gfx::PointF& base, |
| 331 const gfx::PointF& extent); | 328 const gfx::PointF& extent); |
| 332 | 329 |
| 333 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); | 330 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); |
| 334 void OnTouchDown(const base::android::ScopedJavaLocalRef<jobject>& event); | 331 void OnTouchDown(const base::android::ScopedJavaLocalRef<jobject>& event); |
| 335 | 332 |
| 333 ImeAdapterAndroid* ime_adapter() { return ime_adapter_.get(); } |
| 334 |
| 336 ui::ViewAndroid* GetViewAndroid() const; | 335 ui::ViewAndroid* GetViewAndroid() const; |
| 337 | 336 |
| 338 private: | 337 private: |
| 339 class ContentViewUserData; | 338 class ContentViewUserData; |
| 340 | 339 |
| 341 friend class ContentViewUserData; | 340 friend class ContentViewUserData; |
| 342 ~ContentViewCoreImpl() override; | 341 ~ContentViewCoreImpl() override; |
| 343 | 342 |
| 344 // WebContentsObserver implementation. | 343 // WebContentsObserver implementation. |
| 345 void RenderViewReady() override; | 344 void RenderViewReady() override; |
| 346 void RenderViewHostChanged(RenderViewHost* old_host, | 345 void RenderViewHostChanged(RenderViewHost* old_host, |
| 347 RenderViewHost* new_host) override; | 346 RenderViewHost* new_host) override; |
| 347 void DidAttachInterstitialPage() override; |
| 348 void DidDetachInterstitialPage() override; |
| 348 void WebContentsDestroyed() override; | 349 void WebContentsDestroyed() override; |
| 349 | 350 |
| 350 // -------------------------------------------------------------------------- | 351 // -------------------------------------------------------------------------- |
| 351 // Other private methods and data | 352 // Other private methods and data |
| 352 // -------------------------------------------------------------------------- | 353 // -------------------------------------------------------------------------- |
| 353 | 354 |
| 354 void InitWebContents(); | 355 void InitWebContents(); |
| 355 void SendScreenRectsAndResizeWidget(); | 356 void SendScreenRectsAndResizeWidget(); |
| 356 | 357 |
| 357 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; | 358 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 378 // A weak reference to the Java ContentViewCore object. | 379 // A weak reference to the Java ContentViewCore object. |
| 379 JavaObjectWeakGlobalRef java_ref_; | 380 JavaObjectWeakGlobalRef java_ref_; |
| 380 | 381 |
| 381 // Select popup view | 382 // Select popup view |
| 382 ui::ViewAndroid::ScopedAnchorView select_popup_; | 383 ui::ViewAndroid::ScopedAnchorView select_popup_; |
| 383 | 384 |
| 384 // Reference to the current WebContents used to determine how and what to | 385 // Reference to the current WebContents used to determine how and what to |
| 385 // display in the ContentViewCore. | 386 // display in the ContentViewCore. |
| 386 WebContentsImpl* web_contents_; | 387 WebContentsImpl* web_contents_; |
| 387 | 388 |
| 389 std::unique_ptr<ImeAdapterAndroid> ime_adapter_; |
| 390 |
| 388 // Page scale factor. | 391 // Page scale factor. |
| 389 float page_scale_; | 392 float page_scale_; |
| 390 | 393 |
| 391 // Device scale factor. | 394 // Device scale factor. |
| 392 float dpi_scale_; | 395 float dpi_scale_; |
| 393 | 396 |
| 397 // The active RenderWidgetHostViewAndroid that is attached to IME adapter |
| 398 // instance. Can also point to interstitial page if one is showing. |
| 399 RenderWidgetHostViewAndroid* active_rwhva_; |
| 400 |
| 394 // Observer to notify of lifecyle changes. | 401 // Observer to notify of lifecyle changes. |
| 395 base::ObserverList<ContentViewCoreImplObserver> observer_list_; | 402 base::ObserverList<ContentViewCoreImplObserver> observer_list_; |
| 396 | 403 |
| 397 // The cache of device's current orientation set from Java side, this value | 404 // The cache of device's current orientation set from Java side, this value |
| 398 // will be sent to Renderer once it is ready. | 405 // will be sent to Renderer once it is ready. |
| 399 int device_orientation_; | 406 int device_orientation_; |
| 400 | 407 |
| 401 bool accessibility_enabled_; | 408 bool accessibility_enabled_; |
| 402 | 409 |
| 403 // Manages injecting Java objects. | 410 // Manages injecting Java objects. |
| 404 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; | 411 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; |
| 405 | 412 |
| 406 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 413 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 407 }; | 414 }; |
| 408 | 415 |
| 409 bool RegisterContentViewCore(JNIEnv* env); | 416 bool RegisterContentViewCore(JNIEnv* env); |
| 410 | 417 |
| 411 } // namespace content | 418 } // namespace content |
| 412 | 419 |
| 413 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 420 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |