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 #include <list> | 10 #include <list> |
| 11 #include <memory> |
10 #include <string> | 12 #include <string> |
11 #include <utility> | 13 #include <utility> |
12 | 14 |
13 #include "android_webview/browser/aw_browser_permission_request_delegate.h" | 15 #include "android_webview/browser/aw_browser_permission_request_delegate.h" |
14 #include "android_webview/browser/aw_message_port_message_filter.h" | 16 #include "android_webview/browser/aw_message_port_message_filter.h" |
15 #include "android_webview/browser/browser_view_renderer.h" | 17 #include "android_webview/browser/browser_view_renderer.h" |
16 #include "android_webview/browser/browser_view_renderer_client.h" | 18 #include "android_webview/browser/browser_view_renderer_client.h" |
17 #include "android_webview/browser/find_helper.h" | 19 #include "android_webview/browser/find_helper.h" |
18 #include "android_webview/browser/gl_view_renderer_manager.h" | 20 #include "android_webview/browser/gl_view_renderer_manager.h" |
19 #include "android_webview/browser/icon_helper.h" | 21 #include "android_webview/browser/icon_helper.h" |
20 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 22 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
21 #include "android_webview/browser/shared_renderer_state.h" | 23 #include "android_webview/browser/shared_renderer_state.h" |
22 #include "android_webview/browser/shared_renderer_state_client.h" | 24 #include "android_webview/browser/shared_renderer_state_client.h" |
23 #include "android_webview/native/permission/permission_request_handler_client.h" | 25 #include "android_webview/native/permission/permission_request_handler_client.h" |
24 #include "base/android/jni_weak_ref.h" | 26 #include "base/android/jni_weak_ref.h" |
25 #include "base/android/scoped_java_ref.h" | 27 #include "base/android/scoped_java_ref.h" |
26 #include "base/callback_forward.h" | 28 #include "base/callback_forward.h" |
27 #include "base/macros.h" | 29 #include "base/macros.h" |
28 #include "base/memory/scoped_ptr.h" | |
29 | 30 |
30 class SkBitmap; | 31 class SkBitmap; |
31 class TabContents; | 32 class TabContents; |
32 struct AwDrawGLInfo; | 33 struct AwDrawGLInfo; |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 class WebContents; | 36 class WebContents; |
36 } | 37 } |
37 | 38 |
38 namespace android_webview { | 39 namespace android_webview { |
(...skipping 28 matching lines...) Expand all Loading... |
67 public: | 68 public: |
68 // Returns the AwContents instance associated with |web_contents|, or NULL. | 69 // Returns the AwContents instance associated with |web_contents|, or NULL. |
69 static AwContents* FromWebContents(content::WebContents* web_contents); | 70 static AwContents* FromWebContents(content::WebContents* web_contents); |
70 | 71 |
71 // Returns the AwContents instance associated with with the given | 72 // Returns the AwContents instance associated with with the given |
72 // render_process_id and render_view_id, or NULL. | 73 // render_process_id and render_view_id, or NULL. |
73 static AwContents* FromID(int render_process_id, int render_view_id); | 74 static AwContents* FromID(int render_process_id, int render_view_id); |
74 | 75 |
75 static std::string GetLocale(); | 76 static std::string GetLocale(); |
76 | 77 |
77 AwContents(scoped_ptr<content::WebContents> web_contents); | 78 AwContents(std::unique_ptr<content::WebContents> web_contents); |
78 ~AwContents() override; | 79 ~AwContents() override; |
79 | 80 |
80 AwRenderViewHostExt* render_view_host_ext() { | 81 AwRenderViewHostExt* render_view_host_ext() { |
81 return render_view_host_ext_.get(); | 82 return render_view_host_ext_.get(); |
82 } | 83 } |
83 | 84 |
84 // |handler| is an instance of | 85 // |handler| is an instance of |
85 // org.chromium.android_webview.AwHttpAuthHandler. | 86 // org.chromium.android_webview.AwHttpAuthHandler. |
86 bool OnReceivedHttpAuthRequest(const base::android::JavaRef<jobject>& handler, | 87 bool OnReceivedHttpAuthRequest(const base::android::JavaRef<jobject>& handler, |
87 const std::string& host, | 88 const std::string& host, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 const gfx::SizeF& contents_size_dip, | 276 const gfx::SizeF& contents_size_dip, |
276 float page_scale_factor, | 277 float page_scale_factor, |
277 float min_page_scale_factor, | 278 float min_page_scale_factor, |
278 float max_page_scale_factor) override; | 279 float max_page_scale_factor) override; |
279 void DidOverscroll(const gfx::Vector2d& overscroll_delta, | 280 void DidOverscroll(const gfx::Vector2d& overscroll_delta, |
280 const gfx::Vector2dF& overscroll_velocity) override; | 281 const gfx::Vector2dF& overscroll_velocity) override; |
281 | 282 |
282 void ClearCache(JNIEnv* env, | 283 void ClearCache(JNIEnv* env, |
283 const base::android::JavaParamRef<jobject>& obj, | 284 const base::android::JavaParamRef<jobject>& obj, |
284 jboolean include_disk_files); | 285 jboolean include_disk_files); |
285 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); | 286 void SetPendingWebContentsForPopup( |
| 287 std::unique_ptr<content::WebContents> pending); |
286 jlong ReleasePopupAwContents(JNIEnv* env, | 288 jlong ReleasePopupAwContents(JNIEnv* env, |
287 const base::android::JavaParamRef<jobject>& obj); | 289 const base::android::JavaParamRef<jobject>& obj); |
288 | 290 |
289 void ScrollTo(JNIEnv* env, | 291 void ScrollTo(JNIEnv* env, |
290 const base::android::JavaParamRef<jobject>& obj, | 292 const base::android::JavaParamRef<jobject>& obj, |
291 jint x, | 293 jint x, |
292 jint y); | 294 jint y); |
293 void SmoothScroll(JNIEnv* env, | 295 void SmoothScroll(JNIEnv* env, |
294 const base::android::JavaParamRef<jobject>& obj, | 296 const base::android::JavaParamRef<jobject>& obj, |
295 jint target_x, | 297 jint target_x, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 339 |
338 // Geolocation API support | 340 // Geolocation API support |
339 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 341 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
340 void HideGeolocationPrompt(const GURL& origin); | 342 void HideGeolocationPrompt(const GURL& origin); |
341 | 343 |
342 void SetDipScaleInternal(float dip_scale); | 344 void SetDipScaleInternal(float dip_scale); |
343 | 345 |
344 JavaObjectWeakGlobalRef java_ref_; | 346 JavaObjectWeakGlobalRef java_ref_; |
345 SharedRendererState shared_renderer_state_; | 347 SharedRendererState shared_renderer_state_; |
346 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. | 348 BrowserViewRenderer browser_view_renderer_; // Must outlive |web_contents_|. |
347 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 349 std::unique_ptr<AwWebContentsDelegate> web_contents_delegate_; |
348 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; | 350 std::unique_ptr<AwContentsClientBridge> contents_client_bridge_; |
349 scoped_ptr<content::WebContents> web_contents_; | 351 std::unique_ptr<content::WebContents> web_contents_; |
350 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 352 std::unique_ptr<AwRenderViewHostExt> render_view_host_ext_; |
351 scoped_ptr<FindHelper> find_helper_; | 353 std::unique_ptr<FindHelper> find_helper_; |
352 scoped_ptr<IconHelper> icon_helper_; | 354 std::unique_ptr<IconHelper> icon_helper_; |
353 scoped_ptr<AwContents> pending_contents_; | 355 std::unique_ptr<AwContents> pending_contents_; |
354 scoped_ptr<AwPdfExporter> pdf_exporter_; | 356 std::unique_ptr<AwPdfExporter> pdf_exporter_; |
355 scoped_ptr<PermissionRequestHandler> permission_request_handler_; | 357 std::unique_ptr<PermissionRequestHandler> permission_request_handler_; |
356 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; | 358 scoped_refptr<AwMessagePortMessageFilter> message_port_message_filter_; |
357 | 359 |
358 // GURL is supplied by the content layer as requesting frame. | 360 // GURL is supplied by the content layer as requesting frame. |
359 // 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 |
360 // from the permission prompt. | 362 // from the permission prompt. |
361 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 363 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
362 // 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. |
363 std::list<OriginCallback> pending_geolocation_prompts_; | 365 std::list<OriginCallback> pending_geolocation_prompts_; |
364 | 366 |
365 GLViewRendererManager::Key renderer_manager_key_; | 367 GLViewRendererManager::Key renderer_manager_key_; |
366 | 368 |
367 DISALLOW_COPY_AND_ASSIGN(AwContents); | 369 DISALLOW_COPY_AND_ASSIGN(AwContents); |
368 }; | 370 }; |
369 | 371 |
370 bool RegisterAwContents(JNIEnv* env); | 372 bool RegisterAwContents(JNIEnv* env); |
371 | 373 |
372 } // namespace android_webview | 374 } // namespace android_webview |
373 | 375 |
374 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 376 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |