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 <string> | 10 #include <string> |
| 11 #include <utility> |
10 | 12 |
11 #include "android_webview/browser/find_helper.h" | 13 #include "android_webview/browser/find_helper.h" |
12 #include "android_webview/browser/icon_helper.h" | 14 #include "android_webview/browser/icon_helper.h" |
13 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 15 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
14 #include "android_webview/public/browser/draw_gl.h" | 16 #include "android_webview/public/browser/draw_gl.h" |
15 #include "base/android/scoped_java_ref.h" | 17 #include "base/android/scoped_java_ref.h" |
16 #include "base/android/jni_helper.h" | 18 #include "base/android/jni_helper.h" |
| 19 #include "base/callback_forward.h" |
17 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
18 #include "content/public/browser/android/compositor.h" | 21 #include "content/public/browser/android/compositor.h" |
19 #include "content/public/browser/javascript_dialog_manager.h" | 22 #include "content/public/browser/javascript_dialog_manager.h" |
20 #include "skia/ext/refptr.h" | 23 #include "skia/ext/refptr.h" |
21 #include "third_party/skia/include/core/SkPicture.h" | 24 #include "third_party/skia/include/core/SkPicture.h" |
22 | 25 |
23 typedef void* EGLContext; | 26 typedef void* EGLContext; |
24 class SkBitmap; | 27 class SkBitmap; |
25 class TabContents; | 28 class TabContents; |
26 | 29 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 int scroll_x, int scroll_y); | 127 int scroll_x, int scroll_y); |
125 void FocusFirstNode(JNIEnv* env, jobject obj); | 128 void FocusFirstNode(JNIEnv* env, jobject obj); |
126 base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, | 129 base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, |
127 jobject obj); | 130 jobject obj); |
128 void EnableOnNewPicture(JNIEnv* env, | 131 void EnableOnNewPicture(JNIEnv* env, |
129 jobject obj, | 132 jobject obj, |
130 jboolean enabled, | 133 jboolean enabled, |
131 jboolean invalidation_only); | 134 jboolean invalidation_only); |
132 | 135 |
133 // Geolocation API support | 136 // Geolocation API support |
134 void OnGeolocationShowPrompt(int render_process_id, | 137 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); |
135 int render_view_id, | 138 void HideGeolocationPrompt(const GURL& origin); |
136 int bridge_id, | 139 void InvokeGeolocationCallback(JNIEnv* env, |
137 const GURL& requesting_frame); | 140 jobject obj, |
138 void OnGeolocationHidePrompt(); | 141 jboolean value, |
| 142 jstring origin); |
139 | 143 |
140 // Find-in-page API and related methods. | 144 // Find-in-page API and related methods. |
141 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); | 145 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); |
142 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); | 146 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); |
143 void FindNext(JNIEnv* env, jobject obj, jboolean forward); | 147 void FindNext(JNIEnv* env, jobject obj, jboolean forward); |
144 void ClearMatches(JNIEnv* env, jobject obj); | 148 void ClearMatches(JNIEnv* env, jobject obj); |
145 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); | 149 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); |
146 | 150 |
147 FindHelper* GetFindHelper(); | 151 FindHelper* GetFindHelper(); |
148 | 152 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 bool RenderPicture(SkCanvas* canvas); | 184 bool RenderPicture(SkCanvas* canvas); |
181 | 185 |
182 JavaObjectWeakGlobalRef java_ref_; | 186 JavaObjectWeakGlobalRef java_ref_; |
183 scoped_ptr<content::WebContents> web_contents_; | 187 scoped_ptr<content::WebContents> web_contents_; |
184 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 188 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
185 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 189 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
186 scoped_ptr<FindHelper> find_helper_; | 190 scoped_ptr<FindHelper> find_helper_; |
187 scoped_ptr<IconHelper> icon_helper_; | 191 scoped_ptr<IconHelper> icon_helper_; |
188 scoped_ptr<content::WebContents> pending_contents_; | 192 scoped_ptr<content::WebContents> pending_contents_; |
189 | 193 |
| 194 // GURL is supplied by the content layer as requesting frame. |
| 195 // Callback is supplied by the content layer, and is invoked with the result |
| 196 // from the permission prompt. |
| 197 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; |
| 198 // The first element in the list is always the currently pending request. |
| 199 std::list<OriginCallback> pending_geolocation_prompts_; |
| 200 |
190 // Compositor-specific state. | 201 // Compositor-specific state. |
191 scoped_ptr<content::Compositor> compositor_; | 202 scoped_ptr<content::Compositor> compositor_; |
192 scoped_refptr<cc::Layer> scissor_clip_layer_; | 203 scoped_refptr<cc::Layer> scissor_clip_layer_; |
193 scoped_refptr<cc::Layer> transform_layer_; | 204 scoped_refptr<cc::Layer> transform_layer_; |
194 scoped_refptr<cc::Layer> view_clip_layer_; | 205 scoped_refptr<cc::Layer> view_clip_layer_; |
195 gfx::Point hw_rendering_scroll_; | 206 gfx::Point hw_rendering_scroll_; |
196 gfx::Size view_size_; | 207 gfx::Size view_size_; |
197 bool view_visible_; | 208 bool view_visible_; |
198 bool compositor_visible_; | 209 bool compositor_visible_; |
199 bool is_composite_pending_; | 210 bool is_composite_pending_; |
200 float dpi_scale_; | 211 float dpi_scale_; |
201 OnNewPictureMode on_new_picture_mode_; | 212 OnNewPictureMode on_new_picture_mode_; |
202 | 213 |
203 // Used only for detecting Android View System context changes. | 214 // Used only for detecting Android View System context changes. |
204 // Not to be used between draw calls. | 215 // Not to be used between draw calls. |
205 EGLContext last_frame_context_; | 216 EGLContext last_frame_context_; |
206 | 217 |
207 DISALLOW_COPY_AND_ASSIGN(AwContents); | 218 DISALLOW_COPY_AND_ASSIGN(AwContents); |
208 }; | 219 }; |
209 | 220 |
210 bool RegisterAwContents(JNIEnv* env); | 221 bool RegisterAwContents(JNIEnv* env); |
211 | 222 |
212 } // namespace android_webview | 223 } // namespace android_webview |
213 | 224 |
214 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 225 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |