| 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 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "android_webview/browser/aw_browser_permission_request_delegate.h" | 13 #include "android_webview/browser/aw_browser_permission_request_delegate.h" |
| 14 #include "android_webview/browser/aw_gl_methods.h" |
| 14 #include "android_webview/browser/browser_view_renderer.h" | 15 #include "android_webview/browser/browser_view_renderer.h" |
| 15 #include "android_webview/browser/browser_view_renderer_client.h" | 16 #include "android_webview/browser/browser_view_renderer_client.h" |
| 17 #include "android_webview/browser/compositor_proxy.h" |
| 16 #include "android_webview/browser/find_helper.h" | 18 #include "android_webview/browser/find_helper.h" |
| 17 #include "android_webview/browser/gl_view_renderer_manager.h" | 19 #include "android_webview/browser/gl_view_renderer_manager.h" |
| 18 #include "android_webview/browser/icon_helper.h" | 20 #include "android_webview/browser/icon_helper.h" |
| 19 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 21 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
| 20 #include "android_webview/browser/shared_renderer_state.h" | |
| 21 #include "android_webview/native/permission/permission_request_handler_client.h" | 22 #include "android_webview/native/permission/permission_request_handler_client.h" |
| 22 #include "base/android/jni_weak_ref.h" | 23 #include "base/android/jni_weak_ref.h" |
| 23 #include "base/android/scoped_java_ref.h" | 24 #include "base/android/scoped_java_ref.h" |
| 24 #include "base/callback_forward.h" | 25 #include "base/callback_forward.h" |
| 25 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
| 26 | 27 |
| 27 class SkBitmap; | 28 class SkBitmap; |
| 28 class TabContents; | 29 class TabContents; |
| 29 struct AwDrawGLInfo; | 30 struct AwDrawGLInfo; |
| 30 | 31 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 // 1:1 lifetime and relationship. The exception is the java instance that | 52 // 1:1 lifetime and relationship. The exception is the java instance that |
| 52 // hosts a popup will be rebound to a second native instance (carrying the | 53 // hosts a popup will be rebound to a second native instance (carrying the |
| 53 // popup content) and discard the 'default' native instance it made on | 54 // popup content) and discard the 'default' native instance it made on |
| 54 // construction. A native instance is only bound to at most one Java peer over | 55 // construction. A native instance is only bound to at most one Java peer over |
| 55 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the | 56 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the |
| 56 // construction points, and SetJavaPeers() where these paths join. | 57 // construction points, and SetJavaPeers() where these paths join. |
| 57 class AwContents : public FindHelper::Listener, | 58 class AwContents : public FindHelper::Listener, |
| 58 public IconHelper::Listener, | 59 public IconHelper::Listener, |
| 59 public AwRenderViewHostExtClient, | 60 public AwRenderViewHostExtClient, |
| 60 public BrowserViewRendererClient, | 61 public BrowserViewRendererClient, |
| 62 public AwGLMethods, |
| 61 public PermissionRequestHandlerClient, | 63 public PermissionRequestHandlerClient, |
| 62 public AwBrowserPermissionRequestDelegate { | 64 public AwBrowserPermissionRequestDelegate { |
| 63 public: | 65 public: |
| 64 // Returns the AwContents instance associated with |web_contents|, or NULL. | 66 // Returns the AwContents instance associated with |web_contents|, or NULL. |
| 65 static AwContents* FromWebContents(content::WebContents* web_contents); | 67 static AwContents* FromWebContents(content::WebContents* web_contents); |
| 66 | 68 |
| 67 // Returns the AwContents instance associated with with the given | 69 // Returns the AwContents instance associated with with the given |
| 68 // render_process_id and render_view_id, or NULL. | 70 // render_process_id and render_view_id, or NULL. |
| 69 static AwContents* FromID(int render_process_id, int render_view_id); | 71 static AwContents* FromID(int render_process_id, int render_view_id); |
| 70 | 72 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 const SkBitmap& bitmap) override; | 183 const SkBitmap& bitmap) override; |
| 182 virtual void OnReceivedTouchIconUrl(const std::string& url, | 184 virtual void OnReceivedTouchIconUrl(const std::string& url, |
| 183 const bool precomposed) override; | 185 const bool precomposed) override; |
| 184 | 186 |
| 185 // AwRenderViewHostExtClient implementation. | 187 // AwRenderViewHostExtClient implementation. |
| 186 virtual void OnWebLayoutPageScaleFactorChanged( | 188 virtual void OnWebLayoutPageScaleFactorChanged( |
| 187 float page_scale_factor) override; | 189 float page_scale_factor) override; |
| 188 virtual void OnWebLayoutContentsSizeChanged( | 190 virtual void OnWebLayoutContentsSizeChanged( |
| 189 const gfx::Size& contents_size) override; | 191 const gfx::Size& contents_size) override; |
| 190 | 192 |
| 193 // AwGLMethods implementation. |
| 194 virtual bool RequestDrawGL(jobject canvas, bool wait_for_completion) override; |
| 195 virtual void InvalidateOnFunctorDestroy() override; |
| 196 |
| 191 // BrowserViewRendererClient implementation. | 197 // BrowserViewRendererClient implementation. |
| 192 virtual bool RequestDrawGL(jobject canvas, bool wait_for_completion) override; | |
| 193 virtual void PostInvalidate() override; | 198 virtual void PostInvalidate() override; |
| 194 virtual void UpdateParentDrawConstraints() override; | |
| 195 virtual void DidSkipCommitFrame() override; | |
| 196 virtual void OnNewPicture() override; | 199 virtual void OnNewPicture() override; |
| 197 virtual gfx::Point GetLocationOnScreen() override; | 200 virtual gfx::Point GetLocationOnScreen() override; |
| 198 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) override; | 201 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) override; |
| 199 virtual bool IsFlingActive() const override; | 202 virtual bool IsFlingActive() const override; |
| 200 virtual void UpdateScrollState(gfx::Vector2d max_scroll_offset, | 203 virtual void UpdateScrollState(gfx::Vector2d max_scroll_offset, |
| 201 gfx::SizeF contents_size_dip, | 204 gfx::SizeF contents_size_dip, |
| 202 float page_scale_factor, | 205 float page_scale_factor, |
| 203 float min_page_scale_factor, | 206 float min_page_scale_factor, |
| 204 float max_page_scale_factor) override; | 207 float max_page_scale_factor) override; |
| 205 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) override; | 208 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) override; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 232 void HideGeolocationPrompt(const GURL& origin); | 235 void HideGeolocationPrompt(const GURL& origin); |
| 233 | 236 |
| 234 JavaObjectWeakGlobalRef java_ref_; | 237 JavaObjectWeakGlobalRef java_ref_; |
| 235 scoped_ptr<content::WebContents> web_contents_; | 238 scoped_ptr<content::WebContents> web_contents_; |
| 236 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 239 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 237 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; | 240 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 238 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 241 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 239 scoped_ptr<FindHelper> find_helper_; | 242 scoped_ptr<FindHelper> find_helper_; |
| 240 scoped_ptr<IconHelper> icon_helper_; | 243 scoped_ptr<IconHelper> icon_helper_; |
| 241 scoped_ptr<AwContents> pending_contents_; | 244 scoped_ptr<AwContents> pending_contents_; |
| 242 SharedRendererState shared_renderer_state_; | 245 CompositorProxy compositor_proxy_; |
| 243 BrowserViewRenderer browser_view_renderer_; | 246 BrowserViewRenderer browser_view_renderer_; |
| 244 scoped_ptr<HardwareRenderer> hardware_renderer_; | 247 scoped_ptr<HardwareRenderer> hardware_renderer_; |
| 245 scoped_ptr<AwPdfExporter> pdf_exporter_; | 248 scoped_ptr<AwPdfExporter> pdf_exporter_; |
| 246 scoped_ptr<PermissionRequestHandler> permission_request_handler_; | 249 scoped_ptr<PermissionRequestHandler> permission_request_handler_; |
| 247 | 250 |
| 248 // GURL is supplied by the content layer as requesting frame. | 251 // GURL is supplied by the content layer as requesting frame. |
| 249 // Callback is supplied by the content layer, and is invoked with the result | 252 // Callback is supplied by the content layer, and is invoked with the result |
| 250 // from the permission prompt. | 253 // from the permission prompt. |
| 251 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 254 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
| 252 // The first element in the list is always the currently pending request. | 255 // The first element in the list is always the currently pending request. |
| 253 std::list<OriginCallback> pending_geolocation_prompts_; | 256 std::list<OriginCallback> pending_geolocation_prompts_; |
| 254 | 257 |
| 255 base::Lock render_thread_lock_; | 258 base::Lock render_thread_lock_; |
| 256 GLViewRendererManager::Key renderer_manager_key_; | 259 GLViewRendererManager::Key renderer_manager_key_; |
| 257 | 260 |
| 258 DISALLOW_COPY_AND_ASSIGN(AwContents); | 261 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 259 }; | 262 }; |
| 260 | 263 |
| 261 bool RegisterAwContents(JNIEnv* env); | 264 bool RegisterAwContents(JNIEnv* env); |
| 262 | 265 |
| 263 } // namespace android_webview | 266 } // namespace android_webview |
| 264 | 267 |
| 265 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 268 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| OLD | NEW |