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 <string> | 9 #include <string> |
10 | 10 |
11 #include "android_webview/browser/find_helper.h" | 11 #include "android_webview/browser/find_helper.h" |
12 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 12 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
13 #include "android_webview/public/browser/draw_gl.h" | 13 #include "android_webview/public/browser/draw_gl.h" |
14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
15 #include "base/android/jni_helper.h" | 15 #include "base/android/jni_helper.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "content/public/browser/android/compositor.h" | 17 #include "content/public/browser/android/compositor.h" |
18 #include "content/public/browser/javascript_dialogs.h" | 18 #include "content/public/browser/javascript_dialogs.h" |
19 #include "skia/ext/refptr.h" | |
20 #include "third_party/skia/include/core/SkPicture.h" | |
19 | 21 |
20 typedef void* EGLContext; | 22 typedef void* EGLContext; |
21 class TabContents; | 23 class TabContents; |
22 | 24 |
23 namespace cc { | 25 namespace cc { |
24 class Layer; | 26 class Layer; |
25 } | 27 } |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 class Compositor; | 30 class Compositor; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 bool window_visible, | 96 bool window_visible, |
95 bool view_visible); | 97 bool view_visible); |
96 void OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h); | 98 void OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h); |
97 void OnDetachedFromWindow(JNIEnv* env, jobject obj); | 99 void OnDetachedFromWindow(JNIEnv* env, jobject obj); |
98 base::android::ScopedJavaLocalRef<jbyteArray> GetOpaqueState( | 100 base::android::ScopedJavaLocalRef<jbyteArray> GetOpaqueState( |
99 JNIEnv* env, jobject obj); | 101 JNIEnv* env, jobject obj); |
100 jboolean RestoreFromOpaqueState(JNIEnv* env, jobject obj, jbyteArray state); | 102 jboolean RestoreFromOpaqueState(JNIEnv* env, jobject obj, jbyteArray state); |
101 void SetScrollForHWFrame(JNIEnv* env, jobject obj, | 103 void SetScrollForHWFrame(JNIEnv* env, jobject obj, |
102 int scroll_x, int scroll_y); | 104 int scroll_x, int scroll_y); |
103 void FocusFirstNode(JNIEnv* env, jobject obj); | 105 void FocusFirstNode(JNIEnv* env, jobject obj); |
106 base::android::ScopedJavaLocalRef<jobject> CapturePicture(JNIEnv* env, | |
107 jobject obj); | |
108 void EnableOnNewPicture(JNIEnv* env, | |
109 jobject obj, | |
110 jboolean enabled, | |
111 jboolean invalidation_only); | |
104 | 112 |
105 // Geolocation API support | 113 // Geolocation API support |
106 void OnGeolocationShowPrompt(int render_process_id, | 114 void OnGeolocationShowPrompt(int render_process_id, |
107 int render_view_id, | 115 int render_view_id, |
108 int bridge_id, | 116 int bridge_id, |
109 const GURL& requesting_frame); | 117 const GURL& requesting_frame); |
110 void OnGeolocationHidePrompt(); | 118 void OnGeolocationHidePrompt(); |
111 | 119 |
112 // Find-in-page API and related methods. | 120 // Find-in-page API and related methods. |
113 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); | 121 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); |
(...skipping 12 matching lines...) Expand all Loading... | |
126 // content::Compositor::Client implementation. | 134 // content::Compositor::Client implementation. |
127 virtual void ScheduleComposite() OVERRIDE; | 135 virtual void ScheduleComposite() OVERRIDE; |
128 virtual void OnSwapBuffersCompleted() OVERRIDE; | 136 virtual void OnSwapBuffersCompleted() OVERRIDE; |
129 | 137 |
130 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); | 138 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); |
131 jint ReleasePopupWebContents(JNIEnv* env, jobject obj); | 139 jint ReleasePopupWebContents(JNIEnv* env, jobject obj); |
132 | 140 |
133 // AwRenderViewHostExt::Client implementation. | 141 // AwRenderViewHostExt::Client implementation. |
134 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; | 142 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; |
135 | 143 |
144 // Returns the latest locally available picture if any. | |
145 // If none is available will synchronously request the latest one. | |
joth
2013/01/12 02:36:28
.. and block until the result is received.
(I know
Leandro GraciĆ” Gil
2013/01/12 17:59:14
Done.
| |
146 skia::RefPtr<SkPicture> GetLastCapturedPicture(); | |
147 | |
136 private: | 148 private: |
137 void Invalidate(); | 149 void Invalidate(); |
138 void SetWebContents(content::WebContents* web_contents); | 150 void SetWebContents(content::WebContents* web_contents); |
139 void SetCompositorVisibility(bool visible); | 151 void SetCompositorVisibility(bool visible); |
140 void ResetCompositor(); | 152 void ResetCompositor(); |
141 void AttachLayerTree(); | 153 void AttachLayerTree(); |
142 | 154 |
143 JavaObjectWeakGlobalRef java_ref_; | 155 JavaObjectWeakGlobalRef java_ref_; |
144 scoped_ptr<content::WebContents> web_contents_; | 156 scoped_ptr<content::WebContents> web_contents_; |
145 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 157 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
146 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 158 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
147 scoped_ptr<FindHelper> find_helper_; | 159 scoped_ptr<FindHelper> find_helper_; |
148 scoped_ptr<content::WebContents> pending_contents_; | 160 scoped_ptr<content::WebContents> pending_contents_; |
149 | 161 |
150 // Compositor-specific state. | 162 // Compositor-specific state. |
151 scoped_ptr<content::Compositor> compositor_; | 163 scoped_ptr<content::Compositor> compositor_; |
152 scoped_refptr<cc::Layer> scissor_clip_layer_; | 164 scoped_refptr<cc::Layer> scissor_clip_layer_; |
153 scoped_refptr<cc::Layer> transform_layer_; | 165 scoped_refptr<cc::Layer> transform_layer_; |
154 scoped_refptr<cc::Layer> view_clip_layer_; | 166 scoped_refptr<cc::Layer> view_clip_layer_; |
155 gfx::Point hw_rendering_scroll_; | 167 gfx::Point hw_rendering_scroll_; |
156 gfx::Size view_size_; | 168 gfx::Size view_size_; |
157 bool view_visible_; | 169 bool view_visible_; |
158 bool compositor_visible_; | 170 bool compositor_visible_; |
159 bool is_composite_pending_; | 171 bool is_composite_pending_; |
172 bool on_new_picture_enabled_; | |
173 bool on_new_picture_invalidation_only_; | |
160 | 174 |
161 // Used only for detecting Android View System context changes. | 175 // Used only for detecting Android View System context changes. |
162 // Not to be used between draw calls. | 176 // Not to be used between draw calls. |
163 EGLContext last_frame_context_; | 177 EGLContext last_frame_context_; |
164 | 178 |
165 DISALLOW_COPY_AND_ASSIGN(AwContents); | 179 DISALLOW_COPY_AND_ASSIGN(AwContents); |
166 }; | 180 }; |
167 | 181 |
168 bool RegisterAwContents(JNIEnv* env); | 182 bool RegisterAwContents(JNIEnv* env); |
169 | 183 |
170 } // namespace android_webview | 184 } // namespace android_webview |
171 | 185 |
172 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 186 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |