| 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> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // hosts a popup will be rebound to a second native instance (carrying the | 56 // hosts a popup will be rebound to a second native instance (carrying the |
| 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 RenderThreadManagerClient { | |
| 68 public: | 67 public: |
| 69 // Returns the AwContents instance associated with |web_contents|, or NULL. | 68 // Returns the AwContents instance associated with |web_contents|, or NULL. |
| 70 static AwContents* FromWebContents(content::WebContents* web_contents); | 69 static AwContents* FromWebContents(content::WebContents* web_contents); |
| 71 | 70 |
| 72 // Returns the AwContents instance associated with with the given | 71 // Returns the AwContents instance associated with with the given |
| 73 // render_process_id and render_view_id, or NULL. | 72 // render_process_id and render_view_id, or NULL. |
| 74 static AwContents* FromID(int render_process_id, int render_view_id); | 73 static AwContents* FromID(int render_process_id, int render_view_id); |
| 75 | 74 |
| 76 static std::string GetLocale(); | 75 static std::string GetLocale(); |
| 77 | 76 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 const base::android::JavaParamRef<jobject>& obj, | 95 const base::android::JavaParamRef<jobject>& obj, |
| 97 const base::android::JavaParamRef<jobject>& aw_contents, | 96 const base::android::JavaParamRef<jobject>& aw_contents, |
| 98 const base::android::JavaParamRef<jobject>& web_contents_delegate, | 97 const base::android::JavaParamRef<jobject>& web_contents_delegate, |
| 99 const base::android::JavaParamRef<jobject>& contents_client_bridge, | 98 const base::android::JavaParamRef<jobject>& contents_client_bridge, |
| 100 const base::android::JavaParamRef<jobject>& io_thread_client, | 99 const base::android::JavaParamRef<jobject>& io_thread_client, |
| 101 const base::android::JavaParamRef<jobject>& | 100 const base::android::JavaParamRef<jobject>& |
| 102 intercept_navigation_delegate); | 101 intercept_navigation_delegate); |
| 103 base::android::ScopedJavaLocalRef<jobject> GetWebContents( | 102 base::android::ScopedJavaLocalRef<jobject> GetWebContents( |
| 104 JNIEnv* env, | 103 JNIEnv* env, |
| 105 const base::android::JavaParamRef<jobject>& obj); | 104 const base::android::JavaParamRef<jobject>& obj); |
| 105 void SetAwGLFunctor(JNIEnv* env, |
| 106 const base::android::JavaParamRef<jobject>& obj, |
| 107 jlong gl_functor); |
| 106 | 108 |
| 107 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 109 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 108 void DocumentHasImages(JNIEnv* env, | 110 void DocumentHasImages(JNIEnv* env, |
| 109 const base::android::JavaParamRef<jobject>& obj, | 111 const base::android::JavaParamRef<jobject>& obj, |
| 110 const base::android::JavaParamRef<jobject>& message); | 112 const base::android::JavaParamRef<jobject>& message); |
| 111 void GenerateMHTML(JNIEnv* env, | 113 void GenerateMHTML(JNIEnv* env, |
| 112 const base::android::JavaParamRef<jobject>& obj, | 114 const base::android::JavaParamRef<jobject>& obj, |
| 113 const base::android::JavaParamRef<jstring>& jpath, | 115 const base::android::JavaParamRef<jstring>& jpath, |
| 114 const base::android::JavaParamRef<jobject>& callback); | 116 const base::android::JavaParamRef<jobject>& callback); |
| 115 void CreatePdfExporter( | 117 void CreatePdfExporter( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 bool OnDraw(JNIEnv* env, | 175 bool OnDraw(JNIEnv* env, |
| 174 const base::android::JavaParamRef<jobject>& obj, | 176 const base::android::JavaParamRef<jobject>& obj, |
| 175 const base::android::JavaParamRef<jobject>& canvas, | 177 const base::android::JavaParamRef<jobject>& canvas, |
| 176 jboolean is_hardware_accelerated, | 178 jboolean is_hardware_accelerated, |
| 177 jint scroll_x, | 179 jint scroll_x, |
| 178 jint scroll_y, | 180 jint scroll_y, |
| 179 jint visible_left, | 181 jint visible_left, |
| 180 jint visible_top, | 182 jint visible_top, |
| 181 jint visible_right, | 183 jint visible_right, |
| 182 jint visible_bottom); | 184 jint visible_bottom); |
| 183 jlong GetAwDrawGLViewContext(JNIEnv* env, | |
| 184 const base::android::JavaParamRef<jobject>& obj); | |
| 185 jlong CapturePicture(JNIEnv* env, | 185 jlong CapturePicture(JNIEnv* env, |
| 186 const base::android::JavaParamRef<jobject>& obj, | 186 const base::android::JavaParamRef<jobject>& obj, |
| 187 int width, | 187 int width, |
| 188 int height); | 188 int height); |
| 189 void EnableOnNewPicture(JNIEnv* env, | 189 void EnableOnNewPicture(JNIEnv* env, |
| 190 const base::android::JavaParamRef<jobject>& obj, | 190 const base::android::JavaParamRef<jobject>& obj, |
| 191 jboolean enabled); | 191 jboolean enabled); |
| 192 void InsertVisualStateCallback( | 192 void InsertVisualStateCallback( |
| 193 JNIEnv* env, | 193 JNIEnv* env, |
| 194 const base::android::JavaParamRef<jobject>& obj, | 194 const base::android::JavaParamRef<jobject>& obj, |
| (...skipping 35 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 // RenderThreadManagerClient implementation. | 240 // ex-SharedRendererStateClient implementation. |
| 241 void OnParentDrawConstraintsUpdated() override; | 241 void OnParentDrawConstraintsUpdated(); |
| 242 bool RequestDrawGL(bool wait_for_completion) override; | |
| 243 void DetachFunctorFromView() override; | |
| 244 | 242 |
| 245 // Find-in-page API and related methods. | 243 // Find-in-page API and related methods. |
| 246 void FindAllAsync(JNIEnv* env, | 244 void FindAllAsync(JNIEnv* env, |
| 247 const base::android::JavaParamRef<jobject>& obj, | 245 const base::android::JavaParamRef<jobject>& obj, |
| 248 const base::android::JavaParamRef<jstring>& search_string); | 246 const base::android::JavaParamRef<jstring>& search_string); |
| 249 void FindNext(JNIEnv* env, | 247 void FindNext(JNIEnv* env, |
| 250 const base::android::JavaParamRef<jobject>& obj, | 248 const base::android::JavaParamRef<jobject>& obj, |
| 251 jboolean forward); | 249 jboolean forward); |
| 252 void ClearMatches(JNIEnv* env, | 250 void ClearMatches(JNIEnv* env, |
| 253 const base::android::JavaParamRef<jobject>& obj); | 251 const base::android::JavaParamRef<jobject>& obj); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 private: | 338 private: |
| 341 void InitAutofillIfNecessary(bool enabled); | 339 void InitAutofillIfNecessary(bool enabled); |
| 342 | 340 |
| 343 // Geolocation API support | 341 // Geolocation API support |
| 344 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 342 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
| 345 void HideGeolocationPrompt(const GURL& origin); | 343 void HideGeolocationPrompt(const GURL& origin); |
| 346 | 344 |
| 347 void SetDipScaleInternal(float dip_scale); | 345 void SetDipScaleInternal(float dip_scale); |
| 348 | 346 |
| 349 JavaObjectWeakGlobalRef java_ref_; | 347 JavaObjectWeakGlobalRef java_ref_; |
| 350 RenderThreadManager render_thread_manager_; | |
| 351 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. | 348 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. |
| 352 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; | 349 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 353 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; | 350 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 354 std::unique_ptr<content::WebContents> web_contents_; | 351 std::unique_ptr<content::WebContents> web_contents_; |
| 355 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; | 352 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 356 std::unique_ptr<FindHelper> find_helper_; | 353 std::unique_ptr<FindHelper> find_helper_; |
| 357 std::unique_ptr<IconHelper> icon_helper_; | 354 std::unique_ptr<IconHelper> icon_helper_; |
| 358 std::unique_ptr<AwContents> pending_contents_; | 355 std::unique_ptr<AwContents> pending_contents_; |
| 359 std::unique_ptr<AwPdfExporter> pdf_exporter_; | 356 std::unique_ptr<AwPdfExporter> pdf_exporter_; |
| 360 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; | 357 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; |
| 361 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; | 358 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; |
| 362 | 359 |
| 363 // GURL is supplied by the content layer as requesting frame. | 360 // GURL is supplied by the content layer as requesting frame. |
| 364 // Callback is supplied by the content layer, and is invoked with the result | 361 // Callback is supplied by the content layer, and is invoked with the result |
| 365 // from the permission prompt. | 362 // from the permission prompt. |
| 366 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 363 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
| 367 // The first element in the list is always the currently pending request. | 364 // The first element in the list is always the currently pending request. |
| 368 std::list<OriginCallback> pending_geolocation_prompts_; | 365 std::list<OriginCallback> pending_geolocation_prompts_; |
| 369 | 366 |
| 370 GLViewRendererManager::Key renderer_manager_key_; | 367 GLViewRendererManager::Key renderer_manager_key_; |
| 371 | 368 |
| 372 DISALLOW_COPY_AND_ASSIGN(AwContents); | 369 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 373 }; | 370 }; |
| 374 | 371 |
| 375 bool RegisterAwContents(JNIEnv* env); | 372 bool RegisterAwContents(JNIEnv* env); |
| 376 | 373 |
| 377 } // namespace android_webview | 374 } // namespace android_webview |
| 378 | 375 |
| 379 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 376 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| OLD | NEW |