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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 int scroll_x, int scroll_y); | 123 int scroll_x, int scroll_y); |
121 void FocusFirstNode(JNIEnv* env, jobject obj); | 124 void FocusFirstNode(JNIEnv* env, jobject obj); |
122 base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, | 125 base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, |
123 jobject obj); | 126 jobject obj); |
124 void EnableOnNewPicture(JNIEnv* env, | 127 void EnableOnNewPicture(JNIEnv* env, |
125 jobject obj, | 128 jobject obj, |
126 jboolean enabled, | 129 jboolean enabled, |
127 jboolean invalidation_only); | 130 jboolean invalidation_only); |
128 | 131 |
129 // Geolocation API support | 132 // Geolocation API support |
130 void OnGeolocationShowPrompt(int render_process_id, | 133 void OnGeolocationShowPrompt(const GURL& origin, base::Callback<void(bool)>); |
131 int render_view_id, | 134 void OnGeolocationHidePrompt(const GURL& origin); |
132 int bridge_id, | 135 void InvokeGeolocationCallback( |
133 const GURL& requesting_frame); | 136 JNIEnv* env, jobject obj, jboolean value, jstring origin); |
134 void OnGeolocationHidePrompt(); | |
135 | 137 |
136 // Find-in-page API and related methods. | 138 // Find-in-page API and related methods. |
137 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); | 139 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); |
138 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); | 140 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); |
139 void FindNext(JNIEnv* env, jobject obj, jboolean forward); | 141 void FindNext(JNIEnv* env, jobject obj, jboolean forward); |
140 void ClearMatches(JNIEnv* env, jobject obj); | 142 void ClearMatches(JNIEnv* env, jobject obj); |
141 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); | 143 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); |
142 | 144 |
143 FindHelper* GetFindHelper(); | 145 FindHelper* GetFindHelper(); |
144 | 146 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 bool RenderPicture(SkCanvas* canvas); | 178 bool RenderPicture(SkCanvas* canvas); |
177 | 179 |
178 JavaObjectWeakGlobalRef java_ref_; | 180 JavaObjectWeakGlobalRef java_ref_; |
179 scoped_ptr<content::WebContents> web_contents_; | 181 scoped_ptr<content::WebContents> web_contents_; |
180 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 182 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
181 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 183 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
182 scoped_ptr<FindHelper> find_helper_; | 184 scoped_ptr<FindHelper> find_helper_; |
183 scoped_ptr<IconHelper> icon_helper_; | 185 scoped_ptr<IconHelper> icon_helper_; |
184 scoped_ptr<content::WebContents> pending_contents_; | 186 scoped_ptr<content::WebContents> pending_contents_; |
185 | 187 |
188 typedef std::pair<const GURL&, base::Callback<void(bool)> > OriginCallback; | |
189 std::list<OriginCallback> geolocation_callbacks_; | |
boliu
2013/02/06 20:29:54
man this just begs for a native->java callback tra
Kristian Monsen
2013/02/08 00:07:44
The problem here is that these have to be stored n
| |
190 | |
186 // Compositor-specific state. | 191 // Compositor-specific state. |
187 scoped_ptr<content::Compositor> compositor_; | 192 scoped_ptr<content::Compositor> compositor_; |
188 scoped_refptr<cc::Layer> scissor_clip_layer_; | 193 scoped_refptr<cc::Layer> scissor_clip_layer_; |
189 scoped_refptr<cc::Layer> transform_layer_; | 194 scoped_refptr<cc::Layer> transform_layer_; |
190 scoped_refptr<cc::Layer> view_clip_layer_; | 195 scoped_refptr<cc::Layer> view_clip_layer_; |
191 gfx::Point hw_rendering_scroll_; | 196 gfx::Point hw_rendering_scroll_; |
192 gfx::Size view_size_; | 197 gfx::Size view_size_; |
193 bool view_visible_; | 198 bool view_visible_; |
194 bool compositor_visible_; | 199 bool compositor_visible_; |
195 bool is_composite_pending_; | 200 bool is_composite_pending_; |
196 OnNewPictureMode on_new_picture_mode_; | 201 OnNewPictureMode on_new_picture_mode_; |
197 | 202 |
198 // Used only for detecting Android View System context changes. | 203 // Used only for detecting Android View System context changes. |
199 // Not to be used between draw calls. | 204 // Not to be used between draw calls. |
200 EGLContext last_frame_context_; | 205 EGLContext last_frame_context_; |
201 | 206 |
202 DISALLOW_COPY_AND_ASSIGN(AwContents); | 207 DISALLOW_COPY_AND_ASSIGN(AwContents); |
203 }; | 208 }; |
204 | 209 |
205 bool RegisterAwContents(JNIEnv* env); | 210 bool RegisterAwContents(JNIEnv* env); |
206 | 211 |
207 } // namespace android_webview | 212 } // namespace android_webview |
208 | 213 |
209 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 214 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |