| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 jboolean visible); | 344 jboolean visible); |
| 341 | 345 |
| 342 void GrantFileSchemeAccesstoChildProcess( | 346 void GrantFileSchemeAccesstoChildProcess( |
| 343 JNIEnv* env, | 347 JNIEnv* env, |
| 344 const base::android::JavaParamRef<jobject>& obj); | 348 const base::android::JavaParamRef<jobject>& obj); |
| 345 | 349 |
| 346 void ResumeLoadingCreatedPopupWebContents( | 350 void ResumeLoadingCreatedPopupWebContents( |
| 347 JNIEnv* env, | 351 JNIEnv* env, |
| 348 const base::android::JavaParamRef<jobject>& obj); | 352 const base::android::JavaParamRef<jobject>& obj); |
| 349 | 353 |
| 354 jlong GetAutofillProvider(JNIEnv* env, |
| 355 const base::android::JavaParamRef<jobject>& obj); |
| 356 |
| 350 // content::WebContentsObserver overrides | 357 // content::WebContentsObserver overrides |
| 351 void RenderViewHostChanged(content::RenderViewHost* old_host, | 358 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 352 content::RenderViewHost* new_host) override; | 359 content::RenderViewHost* new_host) override; |
| 353 void DidAttachInterstitialPage() override; | 360 void DidAttachInterstitialPage() override; |
| 354 void DidDetachInterstitialPage() override; | 361 void DidDetachInterstitialPage() override; |
| 355 | 362 |
| 356 // content::RenderProcessHostObserver overrides | 363 // content::RenderProcessHostObserver overrides |
| 357 void RenderProcessReady(content::RenderProcessHost* host) override; | 364 void RenderProcessReady(content::RenderProcessHost* host) override; |
| 358 | 365 |
| 359 // AwSafeBrowsingUIManager::UIManagerClient implementation | 366 // AwSafeBrowsingUIManager::UIManagerClient implementation |
| 360 bool CanShowInterstitial() override; | 367 bool CanShowInterstitial() override; |
| 361 int GetErrorUiType() override; | 368 int GetErrorUiType() override; |
| 362 | 369 |
| 363 void CallProceedOnInterstitialForTesting( | 370 void CallProceedOnInterstitialForTesting( |
| 364 JNIEnv* env, | 371 JNIEnv* env, |
| 365 const base::android::JavaParamRef<jobject>& obj); | 372 const base::android::JavaParamRef<jobject>& obj); |
| 366 void CallDontProceedOnInterstitialForTesting( | 373 void CallDontProceedOnInterstitialForTesting( |
| 367 JNIEnv* env, | 374 JNIEnv* env, |
| 368 const base::android::JavaParamRef<jobject>& obj); | 375 const base::android::JavaParamRef<jobject>& obj); |
| 369 | 376 |
| 370 // AwRenderProcessGoneDelegate overrides | 377 // AwRenderProcessGoneDelegate overrides |
| 371 void OnRenderProcessGone(int child_process_id) override; | 378 void OnRenderProcessGone(int child_process_id) override; |
| 372 bool OnRenderProcessGoneDetail(int child_process_id, bool crashed) override; | 379 bool OnRenderProcessGoneDetail(int child_process_id, bool crashed) override; |
| 373 | 380 |
| 374 private: | 381 private: |
| 375 void InitAutofillIfNecessary(bool enabled); | 382 void InitAutofillIfNecessary(bool autocomplete_enabled); |
| 376 | 383 |
| 377 // Geolocation API support | 384 // Geolocation API support |
| 378 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 385 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
| 379 void HideGeolocationPrompt(const GURL& origin); | 386 void HideGeolocationPrompt(const GURL& origin); |
| 380 | 387 |
| 381 void SetDipScaleInternal(float dip_scale); | 388 void SetDipScaleInternal(float dip_scale); |
| 382 | 389 |
| 383 void SetAwGLFunctor(AwGLFunctor* functor); | 390 void SetAwGLFunctor(AwGLFunctor* functor); |
| 384 | 391 |
| 385 AwRendererPriorityManager* GetAwRendererPriorityManager(); | 392 AwRendererPriorityManager* GetAwRendererPriorityManager(); |
| 386 AwRendererPriorityManager::RendererPriority GetComputedRendererPriority(); | 393 AwRendererPriorityManager::RendererPriority GetComputedRendererPriority(); |
| 387 void UpdateRendererPriority( | 394 void UpdateRendererPriority( |
| 388 AwRendererPriorityManager::RendererPriority base_priority); | 395 AwRendererPriorityManager::RendererPriority base_priority); |
| 389 void UpdateRendererPriority(); | 396 void UpdateRendererPriority(); |
| 390 | 397 |
| 391 JavaObjectWeakGlobalRef java_ref_; | 398 JavaObjectWeakGlobalRef java_ref_; |
| 392 AwGLFunctor* functor_; | 399 AwGLFunctor* functor_; |
| 393 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. | 400 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. |
| 394 std::unique_ptr<content::WebContents> web_contents_; | 401 std::unique_ptr<content::WebContents> web_contents_; |
| 395 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; | 402 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 396 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; | 403 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 397 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; | 404 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 398 std::unique_ptr<FindHelper> find_helper_; | 405 std::unique_ptr<FindHelper> find_helper_; |
| 399 std::unique_ptr<IconHelper> icon_helper_; | 406 std::unique_ptr<IconHelper> icon_helper_; |
| 400 std::unique_ptr<AwContents> pending_contents_; | 407 std::unique_ptr<AwContents> pending_contents_; |
| 401 std::unique_ptr<AwPdfExporter> pdf_exporter_; | 408 std::unique_ptr<AwPdfExporter> pdf_exporter_; |
| 402 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; | 409 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; |
| 410 std::unique_ptr<autofill::AutofillProvider> autofill_provider_; |
| 403 | 411 |
| 404 // GURL is supplied by the content layer as requesting frame. | 412 // GURL is supplied by the content layer as requesting frame. |
| 405 // Callback is supplied by the content layer, and is invoked with the result | 413 // Callback is supplied by the content layer, and is invoked with the result |
| 406 // from the permission prompt. | 414 // from the permission prompt. |
| 407 typedef std::pair<const GURL, base::Callback<void(bool)>> OriginCallback; | 415 typedef std::pair<const GURL, base::Callback<void(bool)>> OriginCallback; |
| 408 // The first element in the list is always the currently pending request. | 416 // The first element in the list is always the currently pending request. |
| 409 std::list<OriginCallback> pending_geolocation_prompts_; | 417 std::list<OriginCallback> pending_geolocation_prompts_; |
| 410 | 418 |
| 411 GLViewRendererManager::Key renderer_manager_key_; | 419 GLViewRendererManager::Key renderer_manager_key_; |
| 412 | 420 |
| 413 AwRendererPriorityManager::RendererPriority renderer_requested_priority_; | 421 AwRendererPriorityManager::RendererPriority renderer_requested_priority_; |
| 414 bool renderer_priority_waived_when_not_visible_; | 422 bool renderer_priority_waived_when_not_visible_; |
| 415 | 423 |
| 416 DISALLOW_COPY_AND_ASSIGN(AwContents); | 424 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 417 }; | 425 }; |
| 418 | 426 |
| 419 bool RegisterAwContents(JNIEnv* env); | 427 bool RegisterAwContents(JNIEnv* env); |
| 420 | 428 |
| 421 } // namespace android_webview | 429 } // namespace android_webview |
| 422 | 430 |
| 423 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ | 431 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_H_ |
| OLD | NEW |