| 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> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // For most purposes the java and native objects can be considered to have | 42 // For most purposes the java and native objects can be considered to have |
| 43 // 1:1 lifetime and relationship. The exception is the java instance that | 43 // 1:1 lifetime and relationship. The exception is the java instance that |
| 44 // hosts a popup will be rebound to a second native instance (carrying the | 44 // hosts a popup will be rebound to a second native instance (carrying the |
| 45 // popup content) and discard the 'default' native instance it made on | 45 // popup content) and discard the 'default' native instance it made on |
| 46 // construction. A native instance is only bound to at most one Java peer over | 46 // construction. A native instance is only bound to at most one Java peer over |
| 47 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the | 47 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the |
| 48 // construction points, and SetJavaPeers() where these paths join. | 48 // construction points, and SetJavaPeers() where these paths join. |
| 49 class AwContents : public FindHelper::Listener, | 49 class AwContents : public FindHelper::Listener, |
| 50 public IconHelper::Listener, | 50 public IconHelper::Listener, |
| 51 public AwRenderViewHostExtClient, | 51 public AwRenderViewHostExtClient, |
| 52 public BrowserViewRenderer::Client { | 52 public BrowserViewRendererClient { |
| 53 public: | 53 public: |
| 54 // Returns the AwContents instance associated with |web_contents|, or NULL. | 54 // Returns the AwContents instance associated with |web_contents|, or NULL. |
| 55 static AwContents* FromWebContents(content::WebContents* web_contents); | 55 static AwContents* FromWebContents(content::WebContents* web_contents); |
| 56 | 56 |
| 57 // Returns the AwContents instance associated with with the given | 57 // Returns the AwContents instance associated with with the given |
| 58 // render_process_id and render_view_id, or NULL. | 58 // render_process_id and render_view_id, or NULL. |
| 59 static AwContents* FromID(int render_process_id, int render_view_id); | 59 static AwContents* FromID(int render_process_id, int render_view_id); |
| 60 | 60 |
| 61 AwContents(scoped_ptr<content::WebContents> web_contents); | 61 AwContents(scoped_ptr<content::WebContents> web_contents); |
| 62 virtual ~AwContents(); | 62 virtual ~AwContents(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 gfx::Vector2d new_value) OVERRIDE; | 165 gfx::Vector2d new_value) OVERRIDE; |
| 166 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) OVERRIDE; | 166 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) OVERRIDE; |
| 167 virtual bool IsFlingActive() const OVERRIDE; | 167 virtual bool IsFlingActive() const OVERRIDE; |
| 168 virtual void SetPageScaleFactorAndLimits( | 168 virtual void SetPageScaleFactorAndLimits( |
| 169 float page_scale_factor, | 169 float page_scale_factor, |
| 170 float min_page_scale_factor, | 170 float min_page_scale_factor, |
| 171 float max_page_scale_factor) OVERRIDE; | 171 float max_page_scale_factor) OVERRIDE; |
| 172 virtual void SetContentsSize(gfx::SizeF contents_size_dip) OVERRIDE; | 172 virtual void SetContentsSize(gfx::SizeF contents_size_dip) OVERRIDE; |
| 173 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) OVERRIDE; | 173 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) OVERRIDE; |
| 174 | 174 |
| 175 const BrowserViewRenderer* GetBrowserViewRenderer() const; |
| 176 |
| 175 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); | 177 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); |
| 176 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); | 178 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); |
| 177 jint ReleasePopupAwContents(JNIEnv* env, jobject obj); | 179 jint ReleasePopupAwContents(JNIEnv* env, jobject obj); |
| 178 | 180 |
| 179 void ScrollTo(JNIEnv* env, jobject obj, jint x, jint y); | 181 void ScrollTo(JNIEnv* env, jobject obj, jint x, jint y); |
| 180 void SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale); | 182 void SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale); |
| 181 void SetFixedLayoutSize(JNIEnv* env, | 183 void SetFixedLayoutSize(JNIEnv* env, |
| 182 jobject obj, | 184 jobject obj, |
| 183 jint width_dip, | 185 jint width_dip, |
| 184 jint height_dip); | 186 jint height_dip); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 195 void SetAndroidWebViewRendererPrefs(); | 197 void SetAndroidWebViewRendererPrefs(); |
| 196 | 198 |
| 197 JavaObjectWeakGlobalRef java_ref_; | 199 JavaObjectWeakGlobalRef java_ref_; |
| 198 scoped_ptr<content::WebContents> web_contents_; | 200 scoped_ptr<content::WebContents> web_contents_; |
| 199 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 201 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 200 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; | 202 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; |
| 201 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 203 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
| 202 scoped_ptr<FindHelper> find_helper_; | 204 scoped_ptr<FindHelper> find_helper_; |
| 203 scoped_ptr<IconHelper> icon_helper_; | 205 scoped_ptr<IconHelper> icon_helper_; |
| 204 scoped_ptr<AwContents> pending_contents_; | 206 scoped_ptr<AwContents> pending_contents_; |
| 205 scoped_ptr<BrowserViewRenderer> browser_view_renderer_; | 207 BrowserViewRenderer browser_view_renderer_; |
| 206 scoped_ptr<AwPdfExporter> pdf_exporter_; | 208 scoped_ptr<AwPdfExporter> pdf_exporter_; |
| 207 | 209 |
| 208 // GURL is supplied by the content layer as requesting frame. | 210 // GURL is supplied by the content layer as requesting frame. |
| 209 // Callback is supplied by the content layer, and is invoked with the result | 211 // Callback is supplied by the content layer, and is invoked with the result |
| 210 // from the permission prompt. | 212 // from the permission prompt. |
| 211 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 213 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
| 212 // The first element in the list is always the currently pending request. | 214 // The first element in the list is always the currently pending request. |
| 213 std::list<OriginCallback> pending_geolocation_prompts_; | 215 std::list<OriginCallback> pending_geolocation_prompts_; |
| 214 | 216 |
| 215 DISALLOW_COPY_AND_ASSIGN(AwContents); | 217 DISALLOW_COPY_AND_ASSIGN(AwContents); |
| 216 }; | 218 }; |
| 217 | 219 |
| 218 bool RegisterAwContents(JNIEnv* env); | 220 bool RegisterAwContents(JNIEnv* env); |
| 219 | 221 |
| 220 } // namespace android_webview | 222 } // namespace android_webview |
| 221 | 223 |
| 222 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 224 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
| OLD | NEW |