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 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 class Compositor; | 35 class Compositor; |
36 class WebContents; | 36 class WebContents; |
37 } | 37 } |
38 | 38 |
39 namespace android_webview { | 39 namespace android_webview { |
40 | 40 |
41 class AwContentsContainer; | 41 class AwContentsContainer; |
| 42 class AwContentsClientBridge; |
42 class AwWebContentsDelegate; | 43 class AwWebContentsDelegate; |
43 | 44 |
44 // Native side of java-class of same name. | 45 // Native side of java-class of same name. |
45 // Provides the ownership of and access to browser components required for | 46 // Provides the ownership of and access to browser components required for |
46 // WebView functionality; analogous to chrome's TabContents, but with a | 47 // WebView functionality; analogous to chrome's TabContents, but with a |
47 // level of indirection provided by the AwContentsContainer abstraction. | 48 // level of indirection provided by the AwContentsContainer abstraction. |
48 class AwContents : public FindHelper::Listener, | 49 class AwContents : public FindHelper::Listener, |
49 public IconHelper::Listener, | 50 public IconHelper::Listener, |
50 public content::Compositor::Client, | 51 public content::Compositor::Client, |
51 public AwRenderViewHostExt::Client { | 52 public AwRenderViewHostExt::Client { |
52 public: | 53 public: |
53 enum OnNewPictureMode { | 54 enum OnNewPictureMode { |
54 kOnNewPictureDisabled = 0, | 55 kOnNewPictureDisabled = 0, |
55 kOnNewPictureEnabled, | 56 kOnNewPictureEnabled, |
56 kOnNewPictureInvalidationOnly, | 57 kOnNewPictureInvalidationOnly, |
57 }; | 58 }; |
58 | 59 |
59 // Returns the AwContents instance associated with |web_contents|, or NULL. | 60 // Returns the AwContents instance associated with |web_contents|, or NULL. |
60 static AwContents* FromWebContents(content::WebContents* web_contents); | 61 static AwContents* FromWebContents(content::WebContents* web_contents); |
61 | 62 |
62 // Returns the AwContents instance associated with with the given | 63 // Returns the AwContents instance associated with with the given |
63 // render_process_id and render_view_id, or NULL. | 64 // render_process_id and render_view_id, or NULL. |
64 static AwContents* FromID(int render_process_id, int render_view_id); | 65 static AwContents* FromID(int render_process_id, int render_view_id); |
65 | 66 |
66 AwContents(JNIEnv* env, | 67 AwContents(JNIEnv* env, |
67 jobject obj, | 68 jobject obj, |
68 jobject web_contents_delegate); | 69 jobject web_contents_delegate, |
| 70 jobject contents_client_bridge); |
69 virtual ~AwContents(); | 71 virtual ~AwContents(); |
70 | 72 |
71 AwRenderViewHostExt* render_view_host_ext() { | 73 AwRenderViewHostExt* render_view_host_ext() { |
72 return render_view_host_ext_.get(); | 74 return render_view_host_ext_.get(); |
73 } | 75 } |
74 | 76 |
75 void DrawGL(AwDrawGLInfo* draw_info); | 77 void DrawGL(AwDrawGLInfo* draw_info); |
76 bool DrawSW(JNIEnv* env, | 78 bool DrawSW(JNIEnv* env, |
77 jobject obj, | 79 jobject obj, |
78 jobject canvas, | 80 jobject canvas, |
(...skipping 18 matching lines...) Expand all Loading... |
97 | 99 |
98 // |handler| is an instance of | 100 // |handler| is an instance of |
99 // org.chromium.android_webview.AwHttpAuthHandler. | 101 // org.chromium.android_webview.AwHttpAuthHandler. |
100 void OnReceivedHttpAuthRequest(const base::android::JavaRef<jobject>& handler, | 102 void OnReceivedHttpAuthRequest(const base::android::JavaRef<jobject>& handler, |
101 const std::string& host, | 103 const std::string& host, |
102 const std::string& realm); | 104 const std::string& realm); |
103 | 105 |
104 // Methods called from Java. | 106 // Methods called from Java. |
105 jint GetWebContents(JNIEnv* env, jobject obj); | 107 jint GetWebContents(JNIEnv* env, jobject obj); |
106 void SetWebContents(JNIEnv* env, jobject obj, jint web_contents); | 108 void SetWebContents(JNIEnv* env, jobject obj, jint web_contents); |
| 109 jint GetAwContentsClientBridge(JNIEnv* env, jobject obj); |
107 | 110 |
108 void DidInitializeContentViewCore(JNIEnv* env, jobject obj, | 111 void DidInitializeContentViewCore(JNIEnv* env, jobject obj, |
109 jint content_view_core); | 112 jint content_view_core); |
110 void Destroy(JNIEnv* env, jobject obj); | 113 void Destroy(JNIEnv* env, jobject obj); |
111 void DocumentHasImages(JNIEnv* env, jobject obj, jobject message); | 114 void DocumentHasImages(JNIEnv* env, jobject obj, jobject message); |
112 void GenerateMHTML(JNIEnv* env, jobject obj, jstring jpath, jobject callback); | 115 void GenerateMHTML(JNIEnv* env, jobject obj, jstring jpath, jobject callback); |
113 void SetIoThreadClient(JNIEnv* env, jobject obj, jobject client); | 116 void SetIoThreadClient(JNIEnv* env, jobject obj, jobject client); |
114 void SetInterceptNavigationDelegate(JNIEnv* env, jobject obj, | 117 void SetInterceptNavigationDelegate(JNIEnv* env, jobject obj, |
115 jobject delegate); | 118 jobject delegate); |
116 void AddVisitedLinks(JNIEnv* env, jobject obj, jobjectArray jvisited_links); | 119 void AddVisitedLinks(JNIEnv* env, jobject obj, jobjectArray jvisited_links); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void SetWebContents(content::WebContents* web_contents); | 186 void SetWebContents(content::WebContents* web_contents); |
184 void SetCompositorVisibility(bool visible); | 187 void SetCompositorVisibility(bool visible); |
185 void ResetCompositor(); | 188 void ResetCompositor(); |
186 void AttachLayerTree(); | 189 void AttachLayerTree(); |
187 bool RenderSW(SkCanvas* canvas); | 190 bool RenderSW(SkCanvas* canvas); |
188 bool RenderPicture(SkCanvas* canvas); | 191 bool RenderPicture(SkCanvas* canvas); |
189 | 192 |
190 JavaObjectWeakGlobalRef java_ref_; | 193 JavaObjectWeakGlobalRef java_ref_; |
191 scoped_ptr<content::WebContents> web_contents_; | 194 scoped_ptr<content::WebContents> web_contents_; |
192 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 195 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
| 196 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; |
193 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 197 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
194 scoped_ptr<FindHelper> find_helper_; | 198 scoped_ptr<FindHelper> find_helper_; |
195 scoped_ptr<IconHelper> icon_helper_; | 199 scoped_ptr<IconHelper> icon_helper_; |
196 scoped_ptr<content::WebContents> pending_contents_; | 200 scoped_ptr<content::WebContents> pending_contents_; |
197 | 201 |
198 // GURL is supplied by the content layer as requesting frame. | 202 // GURL is supplied by the content layer as requesting frame. |
199 // Callback is supplied by the content layer, and is invoked with the result | 203 // Callback is supplied by the content layer, and is invoked with the result |
200 // from the permission prompt. | 204 // from the permission prompt. |
201 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 205 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
202 // The first element in the list is always the currently pending request. | 206 // The first element in the list is always the currently pending request. |
(...skipping 17 matching lines...) Expand all Loading... |
220 EGLContext last_frame_context_; | 224 EGLContext last_frame_context_; |
221 | 225 |
222 DISALLOW_COPY_AND_ASSIGN(AwContents); | 226 DISALLOW_COPY_AND_ASSIGN(AwContents); |
223 }; | 227 }; |
224 | 228 |
225 bool RegisterAwContents(JNIEnv* env); | 229 bool RegisterAwContents(JNIEnv* env); |
226 | 230 |
227 } // namespace android_webview | 231 } // namespace android_webview |
228 | 232 |
229 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 233 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |