| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/android/jni_weak_ref.h" | 28 #include "base/android/jni_weak_ref.h" |
| 29 #include "base/android/scoped_java_ref.h" | 29 #include "base/android/scoped_java_ref.h" |
| 30 #include "base/callback_forward.h" | 30 #include "base/callback_forward.h" |
| 31 #include "base/macros.h" | 31 #include "base/macros.h" |
| 32 #include "content/public/browser/render_process_host_observer.h" | 32 #include "content/public/browser/render_process_host_observer.h" |
| 33 #include "content/public/browser/web_contents_observer.h" | 33 #include "content/public/browser/web_contents_observer.h" |
| 34 | 34 |
| 35 class SkBitmap; | 35 class SkBitmap; |
| 36 class TabContents; | 36 class TabContents; |
| 37 | 37 |
| 38 namespace autofill { |
| 39 class AutofillProvider; |
| 40 } |
| 41 |
| 38 namespace content { | 42 namespace content { |
| 39 class WebContents; | 43 class WebContents; |
| 40 } | 44 } |
| 41 | 45 |
| 42 namespace android_webview { | 46 namespace android_webview { |
| 43 | 47 |
| 44 class AwContentsContainer; | 48 class AwContentsContainer; |
| 45 class AwContentsClientBridge; | 49 class AwContentsClientBridge; |
| 46 class AwGLFunctor; | 50 class AwGLFunctor; |
| 47 class AwPdfExporter; | 51 class AwPdfExporter; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void SetOffscreenPreRaster(bool enabled); | 103 void SetOffscreenPreRaster(bool enabled); |
| 100 | 104 |
| 101 // Methods called from Java. | 105 // Methods called from Java. |
| 102 void SetJavaPeers( | 106 void SetJavaPeers( |
| 103 JNIEnv* env, | 107 JNIEnv* env, |
| 104 const base::android::JavaParamRef<jobject>& obj, | 108 const base::android::JavaParamRef<jobject>& obj, |
| 105 const base::android::JavaParamRef<jobject>& aw_contents, | 109 const base::android::JavaParamRef<jobject>& aw_contents, |
| 106 const base::android::JavaParamRef<jobject>& web_contents_delegate, | 110 const base::android::JavaParamRef<jobject>& web_contents_delegate, |
| 107 const base::android::JavaParamRef<jobject>& contents_client_bridge, | 111 const base::android::JavaParamRef<jobject>& contents_client_bridge, |
| 108 const base::android::JavaParamRef<jobject>& io_thread_client, | 112 const base::android::JavaParamRef<jobject>& io_thread_client, |
| 109 const base::android::JavaParamRef<jobject>& | 113 const base::android::JavaParamRef<jobject>& intercept_navigation_delegate, |
| 110 intercept_navigation_delegate); | 114 const base::android::JavaParamRef<jobject>& autofill_provider); |
| 111 base::android::ScopedJavaLocalRef<jobject> GetWebContents( | 115 base::android::ScopedJavaLocalRef<jobject> GetWebContents( |
| 112 JNIEnv* env, | 116 JNIEnv* env, |
| 113 const base::android::JavaParamRef<jobject>& obj); | 117 const base::android::JavaParamRef<jobject>& obj); |
| 114 void SetAwGLFunctor(JNIEnv* env, | 118 void SetAwGLFunctor(JNIEnv* env, |
| 115 const base::android::JavaParamRef<jobject>& obj, | 119 const base::android::JavaParamRef<jobject>& obj, |
| 116 jlong gl_functor); | 120 jlong gl_functor); |
| 117 | 121 |
| 118 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 122 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 119 void DocumentHasImages(JNIEnv* env, | 123 void DocumentHasImages(JNIEnv* env, |
| 120 const base::android::JavaParamRef<jobject>& obj, | 124 const base::android::JavaParamRef<jobject>& obj, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 const base::android::JavaParamRef<jobjectArray>& ports); | 351 const base::android::JavaParamRef<jobjectArray>& ports); |
| 348 | 352 |
| 349 void GrantFileSchemeAccesstoChildProcess( | 353 void GrantFileSchemeAccesstoChildProcess( |
| 350 JNIEnv* env, | 354 JNIEnv* env, |
| 351 const base::android::JavaParamRef<jobject>& obj); | 355 const base::android::JavaParamRef<jobject>& obj); |
| 352 | 356 |
| 353 void ResumeLoadingCreatedPopupWebContents( | 357 void ResumeLoadingCreatedPopupWebContents( |
| 354 JNIEnv* env, | 358 JNIEnv* env, |
| 355 const base::android::JavaParamRef<jobject>& obj); | 359 const base::android::JavaParamRef<jobject>& obj); |
| 356 | 360 |
| 361 jlong GetAutofillProvider(JNIEnv* env, |
| 362 const base::android::JavaParamRef<jobject>& obj); |
| 363 |
| 357 // content::WebContentsObserver overrides | 364 // content::WebContentsObserver overrides |
| 358 void RenderViewHostChanged(content::RenderViewHost* old_host, | 365 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 359 content::RenderViewHost* new_host) override; | 366 content::RenderViewHost* new_host) override; |
| 360 void DidAttachInterstitialPage() override; | 367 void DidAttachInterstitialPage() override; |
| 361 void DidDetachInterstitialPage() override; | 368 void DidDetachInterstitialPage() override; |
| 362 | 369 |
| 363 // content::RenderProcessHostObserver overrides | 370 // content::RenderProcessHostObserver overrides |
| 364 void RenderProcessReady(content::RenderProcessHost* host) override; | 371 void RenderProcessReady(content::RenderProcessHost* host) override; |
| 365 | 372 |
| 366 // AwSafeBrowsingUIManager::UIManagerClient implementation | 373 // AwSafeBrowsingUIManager::UIManagerClient implementation |
| 367 bool CanShowBigInterstitial() override; | 374 bool CanShowBigInterstitial() override; |
| 368 | 375 |
| 369 void CallProceedOnInterstitialForTesting( | 376 void CallProceedOnInterstitialForTesting( |
| 370 JNIEnv* env, | 377 JNIEnv* env, |
| 371 const base::android::JavaParamRef<jobject>& obj); | 378 const base::android::JavaParamRef<jobject>& obj); |
| 372 void CallDontProceedOnInterstitialForTesting( | 379 void CallDontProceedOnInterstitialForTesting( |
| 373 JNIEnv* env, | 380 JNIEnv* env, |
| 374 const base::android::JavaParamRef<jobject>& obj); | 381 const base::android::JavaParamRef<jobject>& obj); |
| 375 | 382 |
| 376 // AwRenderProcessGoneDelegate overrides | 383 // AwRenderProcessGoneDelegate overrides |
| 377 void OnRenderProcessGone(int child_process_id) override; | 384 void OnRenderProcessGone(int child_process_id) override; |
| 378 bool OnRenderProcessGoneDetail(int child_process_id, bool crashed) override; | 385 bool OnRenderProcessGoneDetail(int child_process_id, bool crashed) override; |
| 379 | 386 |
| 380 private: | 387 private: |
| 381 void InitAutofillIfNecessary(bool enabled); | 388 void InitAutofillIfNecessary(bool autocomplete_enabled); |
| 382 | 389 |
| 383 // Geolocation API support | 390 // Geolocation API support |
| 384 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 391 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
| 385 void HideGeolocationPrompt(const GURL& origin); | 392 void HideGeolocationPrompt(const GURL& origin); |
| 386 | 393 |
| 387 void SetDipScaleInternal(float dip_scale); | 394 void SetDipScaleInternal(float dip_scale); |
| 388 | 395 |
| 389 void SetAwGLFunctor(AwGLFunctor* functor); | 396 void SetAwGLFunctor(AwGLFunctor* functor); |
| 390 | 397 |
| 391 AwRendererPriorityManager* GetAwRendererPriorityManager(); | 398 AwRendererPriorityManager* GetAwRendererPriorityManager(); |
| 392 AwRendererPriorityManager::RendererPriority GetComputedRendererPriority(); | 399 AwRendererPriorityManager::RendererPriority GetComputedRendererPriority(); |
| 393 void UpdateRendererPriority( | 400 void UpdateRendererPriority( |
| 394 AwRendererPriorityManager::RendererPriority base_priority); | 401 AwRendererPriorityManager::RendererPriority base_priority); |
| 395 void UpdateRendererPriority(); | 402 void UpdateRendererPriority(); |
| 396 | 403 |
| 397 JavaObjectWeakGlobalRef java_ref_; | 404 JavaObjectWeakGlobalRef java_ref_; |
| 398 AwGLFunctor* functor_; | 405 AwGLFunctor* functor_; |
| 399 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. | 406 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. |
| 400 std::unique_ptr<content::WebContents> web_contents_; | 407 std::unique_ptr<content::WebContents> web_contents_; |
| 401 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; | 408 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 402 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; | 409 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 403 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; | 410 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 404 std::unique_ptr<FindHelper> find_helper_; | 411 std::unique_ptr<FindHelper> find_helper_; |
| 405 std::unique_ptr<IconHelper> icon_helper_; | 412 std::unique_ptr<IconHelper> icon_helper_; |
| 406 std::unique_ptr<AwContents> pending_contents_; | 413 std::unique_ptr<AwContents> pending_contents_; |
| 407 std::unique_ptr<AwPdfExporter> pdf_exporter_; | 414 std::unique_ptr<AwPdfExporter> pdf_exporter_; |
| 408 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; | 415 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; |
| 416 std::unique_ptr<autofill::AutofillProvider> autofill_provider_; |
| 409 | 417 |
| 410 // GURL is supplied by the content layer as requesting frame. | 418 // GURL is supplied by the content layer as requesting frame. |
| 411 // Callback is supplied by the content layer, and is invoked with the result | 419 // Callback is supplied by the content layer, and is invoked with the result |
| 412 // from the permission prompt. | 420 // from the permission prompt. |
| 413 typedef std::pair<const GURL, base::Callback<void(bool)>> OriginCallback; | 421 typedef std::pair<const GURL, base::Callback<void(bool)>> OriginCallback; |
| 414 // The first element in the list is always the currently pending request. | 422 // The first element in the list is always the currently pending request. |
| 415 std::list<OriginCallback> pending_geolocation_prompts_; | 423 std::list<OriginCallback> pending_geolocation_prompts_; |
| 416 | 424 |
| 417 GLViewRendererManager::Key renderer_manager_key_; | 425 GLViewRendererManager::Key renderer_manager_key_; |
| 418 | 426 |
| 419 AwRendererPriorityManager::RendererPriority renderer_requested_priority_; | 427 AwRendererPriorityManager::RendererPriority renderer_requested_priority_; |
| 420 bool renderer_priority_waived_when_not_visible_; | 428 bool renderer_priority_waived_when_not_visible_; |
| 421 | 429 |
| 422 DISALLOW_COPY_AND_ASSIGN(AwContents); | 430 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 423 }; | 431 }; |
| 424 | 432 |
| 425 bool RegisterAwContents(JNIEnv* env); | 433 bool RegisterAwContents(JNIEnv* env); |
| 426 | 434 |
| 427 } // namespace android_webview | 435 } // namespace android_webview |
| 428 | 436 |
| 429 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ | 437 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ |
| OLD | NEW |