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 18 matching lines...) Expand all Loading... |
29 class WebContents; | 29 class WebContents; |
30 } | 30 } |
31 | 31 |
32 namespace android_webview { | 32 namespace android_webview { |
33 | 33 |
34 class AwContentsContainer; | 34 class AwContentsContainer; |
35 class AwContentsClientBridge; | 35 class AwContentsClientBridge; |
36 class AwPdfExporter; | 36 class AwPdfExporter; |
37 class AwWebContentsDelegate; | 37 class AwWebContentsDelegate; |
38 class HardwareRenderer; | 38 class HardwareRenderer; |
| 39 class PermissionRequestHandler; |
39 | 40 |
40 // Native side of java-class of same name. | 41 // Native side of java-class of same name. |
41 // Provides the ownership of and access to browser components required for | 42 // Provides the ownership of and access to browser components required for |
42 // WebView functionality; analogous to chrome's TabContents, but with a | 43 // WebView functionality; analogous to chrome's TabContents, but with a |
43 // level of indirection provided by the AwContentsContainer abstraction. | 44 // level of indirection provided by the AwContentsContainer abstraction. |
44 // | 45 // |
45 // Object lifetime: | 46 // Object lifetime: |
46 // For most purposes the java and native objects can be considered to have | 47 // For most purposes the java and native objects can be considered to have |
47 // 1:1 lifetime and relationship. The exception is the java instance that | 48 // 1:1 lifetime and relationship. The exception is the java instance that |
48 // hosts a popup will be rebound to a second native instance (carrying the | 49 // hosts a popup will be rebound to a second native instance (carrying the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void DrawGL(AwDrawGLInfo* draw_info); | 131 void DrawGL(AwDrawGLInfo* draw_info); |
131 | 132 |
132 // Geolocation API support | 133 // Geolocation API support |
133 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); | 134 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
134 void HideGeolocationPrompt(const GURL& origin); | 135 void HideGeolocationPrompt(const GURL& origin); |
135 void InvokeGeolocationCallback(JNIEnv* env, | 136 void InvokeGeolocationCallback(JNIEnv* env, |
136 jobject obj, | 137 jobject obj, |
137 jboolean value, | 138 jboolean value, |
138 jstring origin); | 139 jstring origin); |
139 | 140 |
| 141 // Permission API support. |
| 142 void OnPermissionRequest(base::android::ScopedJavaLocalRef<jobject> obj); |
| 143 void OnPermissionRequestCanceled( |
| 144 base::android::ScopedJavaLocalRef<jobject> obj); |
| 145 PermissionRequestHandler* GetPermissionRequestHandler() { |
| 146 return permission_request_handler_.get(); |
| 147 } |
| 148 |
140 // Find-in-page API and related methods. | 149 // Find-in-page API and related methods. |
141 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); | 150 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); |
142 void FindNext(JNIEnv* env, jobject obj, jboolean forward); | 151 void FindNext(JNIEnv* env, jobject obj, jboolean forward); |
143 void ClearMatches(JNIEnv* env, jobject obj); | 152 void ClearMatches(JNIEnv* env, jobject obj); |
144 FindHelper* GetFindHelper(); | 153 FindHelper* GetFindHelper(); |
145 | 154 |
146 // FindHelper::Listener implementation. | 155 // FindHelper::Listener implementation. |
147 virtual void OnFindResultReceived(int active_ordinal, | 156 virtual void OnFindResultReceived(int active_ordinal, |
148 int match_count, | 157 int match_count, |
149 bool finished) OVERRIDE; | 158 bool finished) OVERRIDE; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 222 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
214 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; | 223 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; |
215 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 224 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
216 scoped_ptr<FindHelper> find_helper_; | 225 scoped_ptr<FindHelper> find_helper_; |
217 scoped_ptr<IconHelper> icon_helper_; | 226 scoped_ptr<IconHelper> icon_helper_; |
218 scoped_ptr<AwContents> pending_contents_; | 227 scoped_ptr<AwContents> pending_contents_; |
219 SharedRendererState shared_renderer_state_; | 228 SharedRendererState shared_renderer_state_; |
220 BrowserViewRenderer browser_view_renderer_; | 229 BrowserViewRenderer browser_view_renderer_; |
221 scoped_ptr<HardwareRenderer> hardware_renderer_; | 230 scoped_ptr<HardwareRenderer> hardware_renderer_; |
222 scoped_ptr<AwPdfExporter> pdf_exporter_; | 231 scoped_ptr<AwPdfExporter> pdf_exporter_; |
| 232 scoped_ptr<PermissionRequestHandler> permission_request_handler_; |
223 | 233 |
224 // GURL is supplied by the content layer as requesting frame. | 234 // GURL is supplied by the content layer as requesting frame. |
225 // Callback is supplied by the content layer, and is invoked with the result | 235 // Callback is supplied by the content layer, and is invoked with the result |
226 // from the permission prompt. | 236 // from the permission prompt. |
227 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; | 237 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
228 // The first element in the list is always the currently pending request. | 238 // The first element in the list is always the currently pending request. |
229 std::list<OriginCallback> pending_geolocation_prompts_; | 239 std::list<OriginCallback> pending_geolocation_prompts_; |
230 | 240 |
231 DISALLOW_COPY_AND_ASSIGN(AwContents); | 241 DISALLOW_COPY_AND_ASSIGN(AwContents); |
232 }; | 242 }; |
233 | 243 |
234 bool RegisterAwContents(JNIEnv* env); | 244 bool RegisterAwContents(JNIEnv* env); |
235 | 245 |
236 } // namespace android_webview | 246 } // namespace android_webview |
237 | 247 |
238 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 248 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |