Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: android_webview/native/aw_contents.h

Issue 11823027: [Android WebView] Implement the capture picture API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding findbugs update from 11825002 to make the trybots happy. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool window_visible, 97 bool window_visible,
96 bool view_visible); 98 bool view_visible);
97 void OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h); 99 void OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h);
98 void OnDetachedFromWindow(JNIEnv* env, jobject obj); 100 void OnDetachedFromWindow(JNIEnv* env, jobject obj);
99 base::android::ScopedJavaLocalRef<jbyteArray> GetOpaqueState( 101 base::android::ScopedJavaLocalRef<jbyteArray> GetOpaqueState(
100 JNIEnv* env, jobject obj); 102 JNIEnv* env, jobject obj);
101 jboolean RestoreFromOpaqueState(JNIEnv* env, jobject obj, jbyteArray state); 103 jboolean RestoreFromOpaqueState(JNIEnv* env, jobject obj, jbyteArray state);
102 void SetScrollForHWFrame(JNIEnv* env, jobject obj, 104 void SetScrollForHWFrame(JNIEnv* env, jobject obj,
103 int scroll_x, int scroll_y); 105 int scroll_x, int scroll_y);
104 void FocusFirstNode(JNIEnv* env, jobject obj); 106 void FocusFirstNode(JNIEnv* env, jobject obj);
107 void CapturePicture(JNIEnv* env, jobject obj, jobject picture_data);
108 void EnableOnNewPicture(JNIEnv* env,
109 jobject obj,
110 jboolean enabled,
111 jboolean invalidation_only);
105 112
106 // Find-in-page API and related methods. 113 // Find-in-page API and related methods.
107 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string); 114 jint FindAllSync(JNIEnv* env, jobject obj, jstring search_string);
108 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); 115 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string);
109 void FindNext(JNIEnv* env, jobject obj, jboolean forward); 116 void FindNext(JNIEnv* env, jobject obj, jboolean forward);
110 void ClearMatches(JNIEnv* env, jobject obj); 117 void ClearMatches(JNIEnv* env, jobject obj);
111 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files); 118 void ClearCache(JNIEnv* env, jobject obj, jboolean include_disk_files);
112 119
113 FindHelper* GetFindHelper(); 120 FindHelper* GetFindHelper();
114 121
115 // FindHelper::Listener implementation. 122 // FindHelper::Listener implementation.
116 virtual void OnFindResultReceived(int active_ordinal, 123 virtual void OnFindResultReceived(int active_ordinal,
117 int match_count, 124 int match_count,
118 bool finished) OVERRIDE; 125 bool finished) OVERRIDE;
119 126
120 // content::Compositor::Client implementation. 127 // content::Compositor::Client implementation.
121 virtual void ScheduleComposite() OVERRIDE; 128 virtual void ScheduleComposite() OVERRIDE;
122 virtual void OnSwapBuffersCompleted() OVERRIDE; 129 virtual void OnSwapBuffersCompleted() OVERRIDE;
123 130
124 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); 131 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending);
125 jint ReleasePopupWebContents(JNIEnv* env, jobject obj); 132 jint ReleasePopupWebContents(JNIEnv* env, jobject obj);
126 133
127 // AwRenderViewHostExt::Client implementation. 134 // AwRenderViewHostExt::Client implementation.
128 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; 135 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE;
129 136
137 // Returns the latest locally available picture if any.
138 // If none is available will synchronously request the latest one.
139 skia::RefPtr<SkPicture> GetLastCapturedPicture();
140
130 private: 141 private:
131 void Invalidate(); 142 void Invalidate();
132 void SetWebContents(content::WebContents* web_contents); 143 void SetWebContents(content::WebContents* web_contents);
133 void SetCompositorVisibility(bool visible); 144 void SetCompositorVisibility(bool visible);
134 void ResetCompositor(); 145 void ResetCompositor();
135 void AttachLayerTree(); 146 void AttachLayerTree();
136 147
137 JavaObjectWeakGlobalRef java_ref_; 148 JavaObjectWeakGlobalRef java_ref_;
138 scoped_ptr<content::WebContents> web_contents_; 149 scoped_ptr<content::WebContents> web_contents_;
139 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; 150 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_;
140 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; 151 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_;
141 scoped_ptr<FindHelper> find_helper_; 152 scoped_ptr<FindHelper> find_helper_;
142 scoped_ptr<content::WebContents> pending_contents_; 153 scoped_ptr<content::WebContents> pending_contents_;
143 154
144 // Compositor-specific state. 155 // Compositor-specific state.
145 scoped_ptr<content::Compositor> compositor_; 156 scoped_ptr<content::Compositor> compositor_;
146 scoped_refptr<cc::Layer> scissor_clip_layer_; 157 scoped_refptr<cc::Layer> scissor_clip_layer_;
147 scoped_refptr<cc::Layer> transform_layer_; 158 scoped_refptr<cc::Layer> transform_layer_;
148 scoped_refptr<cc::Layer> view_clip_layer_; 159 scoped_refptr<cc::Layer> view_clip_layer_;
149 gfx::Point hw_rendering_scroll_; 160 gfx::Point hw_rendering_scroll_;
150 gfx::Size view_size_; 161 gfx::Size view_size_;
151 bool view_visible_; 162 bool view_visible_;
152 bool compositor_visible_; 163 bool compositor_visible_;
153 bool is_composite_pending_; 164 bool is_composite_pending_;
165 bool on_new_picture_enabled_;
166 bool on_new_picture_invalidation_only_;
154 167
155 // Used only for detecting Android View System context changes. 168 // Used only for detecting Android View System context changes.
156 // Not to be used between draw calls. 169 // Not to be used between draw calls.
157 EGLContext last_frame_context_; 170 EGLContext last_frame_context_;
158 171
159 DISALLOW_COPY_AND_ASSIGN(AwContents); 172 DISALLOW_COPY_AND_ASSIGN(AwContents);
160 }; 173 };
161 174
162 bool RegisterAwContents(JNIEnv* env); 175 bool RegisterAwContents(JNIEnv* env);
163 176
164 } // namespace android_webview 177 } // namespace android_webview
165 178
166 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ 179 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698