| 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_NATIVE_AW_CONTENTS_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "android_webview/browser/aw_browser_permission_request_delegate.h" | 15 #include "android_webview/browser/aw_browser_permission_request_delegate.h" |
| 16 #include "android_webview/browser/aw_message_port_message_filter.h" | 16 #include "android_webview/browser/aw_message_port_message_filter.h" |
| 17 #include "android_webview/browser/browser_view_renderer.h" | 17 #include "android_webview/browser/browser_view_renderer.h" |
| 18 #include "android_webview/browser/browser_view_renderer_client.h" | 18 #include "android_webview/browser/browser_view_renderer_client.h" |
| 19 #include "android_webview/browser/find_helper.h" | 19 #include "android_webview/browser/find_helper.h" |
| 20 #include "android_webview/browser/gl_view_renderer_manager.h" | 20 #include "android_webview/browser/gl_view_renderer_manager.h" |
| 21 #include "android_webview/browser/icon_helper.h" | 21 #include "android_webview/browser/icon_helper.h" |
| 22 #include "android_webview/browser/render_thread_manager.h" |
| 23 #include "android_webview/browser/render_thread_manager_client.h" |
| 22 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 24 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
| 23 #include "android_webview/browser/shared_renderer_state.h" | |
| 24 #include "android_webview/browser/shared_renderer_state_client.h" | |
| 25 #include "android_webview/native/permission/permission_request_handler_client.h" | 25 #include "android_webview/native/permission/permission_request_handler_client.h" |
| 26 #include "base/android/jni_weak_ref.h" | 26 #include "base/android/jni_weak_ref.h" |
| 27 #include "base/android/scoped_java_ref.h" | 27 #include "base/android/scoped_java_ref.h" |
| 28 #include "base/callback_forward.h" | 28 #include "base/callback_forward.h" |
| 29 #include "base/macros.h" | 29 #include "base/macros.h" |
| 30 | 30 |
| 31 class SkBitmap; | 31 class SkBitmap; |
| 32 class TabContents; | 32 class TabContents; |
| 33 struct AwDrawGLInfo; | 33 struct AwDrawGLInfo; |
| 34 | 34 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 // popup content) and discard the 'default' native instance it made on | 57 // popup content) and discard the 'default' native instance it made on |
| 58 // construction. A native instance is only bound to at most one Java peer over | 58 // construction. A native instance is only bound to at most one Java peer over |
| 59 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the | 59 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the |
| 60 // construction points, and SetJavaPeers() where these paths join. | 60 // construction points, and SetJavaPeers() where these paths join. |
| 61 class AwContents : public FindHelper::Listener, | 61 class AwContents : public FindHelper::Listener, |
| 62 public IconHelper::Listener, | 62 public IconHelper::Listener, |
| 63 public AwRenderViewHostExtClient, | 63 public AwRenderViewHostExtClient, |
| 64 public BrowserViewRendererClient, | 64 public BrowserViewRendererClient, |
| 65 public PermissionRequestHandlerClient, | 65 public PermissionRequestHandlerClient, |
| 66 public AwBrowserPermissionRequestDelegate, | 66 public AwBrowserPermissionRequestDelegate, |
| 67 public SharedRendererStateClient { | 67 public RenderThreadManagerClient { |
| 68 public: | 68 public: |
| 69 // Returns the AwContents instance associated with |web_contents|, or NULL. | 69 // Returns the AwContents instance associated with |web_contents|, or NULL. |
| 70 static AwContents* FromWebContents(content::WebContents* web_contents); | 70 static AwContents* FromWebContents(content::WebContents* web_contents); |
| 71 | 71 |
| 72 // Returns the AwContents instance associated with with the given | 72 // Returns the AwContents instance associated with with the given |
| 73 // render_process_id and render_view_id, or NULL. | 73 // render_process_id and render_view_id, or NULL. |
| 74 static AwContents* FromID(int render_process_id, int render_view_id); | 74 static AwContents* FromID(int render_process_id, int render_view_id); |
| 75 | 75 |
| 76 static std::string GetLocale(); | 76 static std::string GetLocale(); |
| 77 | 77 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 const GURL& origin) override; | 230 const GURL& origin) override; |
| 231 void RequestGeolocationPermission( | 231 void RequestGeolocationPermission( |
| 232 const GURL& origin, | 232 const GURL& origin, |
| 233 const base::Callback<void(bool)>& callback) override; | 233 const base::Callback<void(bool)>& callback) override; |
| 234 void CancelGeolocationPermissionRequests(const GURL& origin) override; | 234 void CancelGeolocationPermissionRequests(const GURL& origin) override; |
| 235 void RequestMIDISysexPermission( | 235 void RequestMIDISysexPermission( |
| 236 const GURL& origin, | 236 const GURL& origin, |
| 237 const base::Callback<void(bool)>& callback) override; | 237 const base::Callback<void(bool)>& callback) override; |
| 238 void CancelMIDISysexPermissionRequests(const GURL& origin) override; | 238 void CancelMIDISysexPermissionRequests(const GURL& origin) override; |
| 239 | 239 |
| 240 // SharedRendererStateClient implementation. | 240 // RenderThreadManagerClient implementation. |
| 241 void OnParentDrawConstraintsUpdated() override; | 241 void OnParentDrawConstraintsUpdated() override; |
| 242 bool RequestDrawGL(bool wait_for_completion) override; | 242 bool RequestDrawGL(bool wait_for_completion) override; |
| 243 void DetachFunctorFromView() override; | 243 void DetachFunctorFromView() override; |
| 244 | 244 |
| 245 // Find-in-page API and related methods. | 245 // Find-in-page API and related methods. |
| 246 void FindAllAsync(JNIEnv* env, | 246 void FindAllAsync(JNIEnv* env, |
| 247 const base::android::JavaParamRef<jobject>& obj, | 247 const base::android::JavaParamRef<jobject>& obj, |
| 248 const base::android::JavaParamRef<jstring>& search_string); | 248 const base::android::JavaParamRef<jstring>& search_string); |
| 249 void FindNext(JNIEnv* env, | 249 void FindNext(JNIEnv* env, |
| 250 const base::android::JavaParamRef<jobject>& obj, | 250 const base::android::JavaParamRef<jobject>& obj, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 private: | 340 private: |
| 341 void InitAutofillIfNecessary(bool enabled); | 341 void InitAutofillIfNecessary(bool enabled); |
| 342 | 342 |
| 343 // Geolocation API support | 343 // Geolocation API support |
| 344 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 344 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
| 345 void HideGeolocationPrompt(const GURL& origin); | 345 void HideGeolocationPrompt(const GURL& origin); |
| 346 | 346 |
| 347 void SetDipScaleInternal(float dip_scale); | 347 void SetDipScaleInternal(float dip_scale); |
| 348 | 348 |
| 349 JavaObjectWeakGlobalRef java_ref_; | 349 JavaObjectWeakGlobalRef java_ref_; |
| 350 SharedRendererState shared_renderer_state_; | 350 RenderThreadManager render_thread_manager_; |
| 351 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. | 351 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. |
| 352 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; | 352 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 353 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; | 353 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 354 std::unique_ptr<content::WebContents> web_contents_; | 354 std::unique_ptr<content::WebContents> web_contents_; |
| 355 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; | 355 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 356 std::unique_ptr<FindHelper> find_helper_; | 356 std::unique_ptr<FindHelper> find_helper_; |
| 357 std::unique_ptr<IconHelper> icon_helper_; | 357 std::unique_ptr<IconHelper> icon_helper_; |
| 358 std::unique_ptr<AwContents> pending_contents_; | 358 std::unique_ptr<AwContents> pending_contents_; |
| 359 std::unique_ptr<AwPdfExporter> pdf_exporter_; | 359 std::unique_ptr<AwPdfExporter> pdf_exporter_; |
| 360 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; | 360 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; |
| 361 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; | 361 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; |
| 362 | 362 |
| 363 // GURL is supplied by the content layer as requesting frame. | 363 // GURL is supplied by the content layer as requesting frame. |
| 364 // Callback is supplied by the content layer, and is invoked with the result | 364 // Callback is supplied by the content layer, and is invoked with the result |
| 365 // from the permission prompt. | 365 // from the permission prompt. |
| 366 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 366 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
| 367 // The first element in the list is always the currently pending request. | 367 // The first element in the list is always the currently pending request. |
| 368 std::list<OriginCallback> pending_geolocation_prompts_; | 368 std::list<OriginCallback> pending_geolocation_prompts_; |
| 369 | 369 |
| 370 GLViewRendererManager::Key renderer_manager_key_; | 370 GLViewRendererManager::Key renderer_manager_key_; |
| 371 | 371 |
| 372 DISALLOW_COPY_AND_ASSIGN(AwContents); | 372 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 373 }; | 373 }; |
| 374 | 374 |
| 375 bool RegisterAwContents(JNIEnv* env); | 375 bool RegisterAwContents(JNIEnv* env); |
| 376 | 376 |
| 377 } // namespace android_webview | 377 } // namespace android_webview |
| 378 | 378 |
| 379 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 379 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| OLD | NEW |