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/aw_certificate_error_handler_base.h" | |
11 #include "android_webview/browser/find_helper.h" | 12 #include "android_webview/browser/find_helper.h" |
12 #include "android_webview/browser/icon_helper.h" | 13 #include "android_webview/browser/icon_helper.h" |
13 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 14 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
14 #include "android_webview/public/browser/draw_gl.h" | 15 #include "android_webview/public/browser/draw_gl.h" |
15 #include "base/android/scoped_java_ref.h" | 16 #include "base/android/scoped_java_ref.h" |
16 #include "base/android/jni_helper.h" | 17 #include "base/android/jni_helper.h" |
18 #include "base/callback.h" | |
17 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
18 #include "content/public/browser/android/compositor.h" | 20 #include "content/public/browser/android/compositor.h" |
19 #include "content/public/browser/javascript_dialogs.h" | 21 #include "content/public/browser/javascript_dialogs.h" |
20 | 22 |
21 typedef void* EGLContext; | 23 typedef void* EGLContext; |
22 class SkBitmap; | 24 class SkBitmap; |
23 class TabContents; | 25 class TabContents; |
24 | 26 |
25 namespace cc { | 27 namespace cc { |
26 class Layer; | 28 class Layer; |
27 } | 29 } |
28 | 30 |
29 namespace content { | 31 namespace content { |
30 class Compositor; | 32 class Compositor; |
31 class WebContents; | 33 class WebContents; |
32 } | 34 } |
33 | 35 |
36 namespace net { | |
37 class X509Certificate; | |
38 } | |
39 | |
34 namespace android_webview { | 40 namespace android_webview { |
35 | 41 |
36 class AwContentsContainer; | 42 class AwContentsContainer; |
37 class AwWebContentsDelegate; | 43 class AwWebContentsDelegate; |
38 | 44 |
39 // Native side of java-class of same name. | 45 // Native side of java-class of same name. |
40 // Provides the ownership of and access to browser components required for | 46 // Provides the ownership of and access to browser components required for |
41 // WebView functionality; analogous to chrome's TabContents, but with a | 47 // WebView functionality; analogous to chrome's TabContents, but with a |
42 // level of indirection provided by the AwContentsContainer abstraction. | 48 // level of indirection provided by the AwContentsContainer abstraction. |
43 class AwContents : public FindHelper::Listener, | 49 class AwContents : public FindHelper::Listener, |
44 public IconHelper::Listener, | 50 public IconHelper::Listener, |
45 public content::Compositor::Client, | 51 public content::Compositor::Client, |
46 public AwRenderViewHostExt::Client { | 52 public AwRenderViewHostExt::Client, |
53 public AwCertificateErrorHandlerBase { | |
47 public: | 54 public: |
48 // Returns the AwContents instance associated with |web_contents|, or NULL. | 55 // Returns the AwContents instance associated with |web_contents|, or NULL. |
49 static AwContents* FromWebContents(content::WebContents* web_contents); | 56 static AwContents* FromWebContents(content::WebContents* web_contents); |
50 | 57 |
51 AwContents(JNIEnv* env, | 58 AwContents(JNIEnv* env, |
52 jobject obj, | 59 jobject obj, |
53 jobject web_contents_delegate); | 60 jobject web_contents_delegate); |
54 virtual ~AwContents(); | 61 virtual ~AwContents(); |
55 | 62 |
56 void DrawGL(AwDrawGLInfo* draw_info); | 63 void DrawGL(AwDrawGLInfo* draw_info); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 // content::Compositor::Client implementation. | 141 // content::Compositor::Client implementation. |
135 virtual void ScheduleComposite() OVERRIDE; | 142 virtual void ScheduleComposite() OVERRIDE; |
136 virtual void OnSwapBuffersCompleted() OVERRIDE; | 143 virtual void OnSwapBuffersCompleted() OVERRIDE; |
137 | 144 |
138 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); | 145 void SetPendingWebContentsForPopup(scoped_ptr<content::WebContents> pending); |
139 jint ReleasePopupWebContents(JNIEnv* env, jobject obj); | 146 jint ReleasePopupWebContents(JNIEnv* env, jobject obj); |
140 | 147 |
141 // AwRenderViewHostExt::Client implementation. | 148 // AwRenderViewHostExt::Client implementation. |
142 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; | 149 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; |
143 | 150 |
151 // AwCertificateErrorHandlerBase implementation | |
152 virtual void AllowCertificateError(int cert_error, | |
153 net::X509Certificate* cert, | |
154 const GURL& request_url, | |
155 const base::Callback<void(bool)>& callback, | |
156 bool* cancel_request) OVERRIDE; | |
boliu
2013/02/01 23:07:13
blank line between methods
sgurun-gerrit only
2013/02/02 01:01:10
Done.
| |
157 // Method called from Java. | |
158 void ProceedSslError(JNIEnv* env, jobject obj, jboolean proceed); | |
159 | |
144 private: | 160 private: |
145 void Invalidate(); | 161 void Invalidate(); |
146 void SetWebContents(content::WebContents* web_contents); | 162 void SetWebContents(content::WebContents* web_contents); |
147 void SetCompositorVisibility(bool visible); | 163 void SetCompositorVisibility(bool visible); |
148 void ResetCompositor(); | 164 void ResetCompositor(); |
149 void AttachLayerTree(); | 165 void AttachLayerTree(); |
150 | 166 |
151 JavaObjectWeakGlobalRef java_ref_; | 167 JavaObjectWeakGlobalRef java_ref_; |
152 scoped_ptr<content::WebContents> web_contents_; | 168 scoped_ptr<content::WebContents> web_contents_; |
153 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; | 169 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; |
154 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; | 170 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; |
155 scoped_ptr<FindHelper> find_helper_; | 171 scoped_ptr<FindHelper> find_helper_; |
156 scoped_ptr<IconHelper> icon_helper_; | 172 scoped_ptr<IconHelper> icon_helper_; |
157 scoped_ptr<content::WebContents> pending_contents_; | 173 scoped_ptr<content::WebContents> pending_contents_; |
174 base::Callback<void(bool)> ssl_error_callback_; | |
158 | 175 |
159 // Compositor-specific state. | 176 // Compositor-specific state. |
160 scoped_ptr<content::Compositor> compositor_; | 177 scoped_ptr<content::Compositor> compositor_; |
161 scoped_refptr<cc::Layer> scissor_clip_layer_; | 178 scoped_refptr<cc::Layer> scissor_clip_layer_; |
162 scoped_refptr<cc::Layer> transform_layer_; | 179 scoped_refptr<cc::Layer> transform_layer_; |
163 scoped_refptr<cc::Layer> view_clip_layer_; | 180 scoped_refptr<cc::Layer> view_clip_layer_; |
164 gfx::Point hw_rendering_scroll_; | 181 gfx::Point hw_rendering_scroll_; |
165 gfx::Size view_size_; | 182 gfx::Size view_size_; |
166 bool view_visible_; | 183 bool view_visible_; |
167 bool compositor_visible_; | 184 bool compositor_visible_; |
168 bool is_composite_pending_; | 185 bool is_composite_pending_; |
169 | 186 |
170 // Used only for detecting Android View System context changes. | 187 // Used only for detecting Android View System context changes. |
171 // Not to be used between draw calls. | 188 // Not to be used between draw calls. |
172 EGLContext last_frame_context_; | 189 EGLContext last_frame_context_; |
173 | 190 |
174 DISALLOW_COPY_AND_ASSIGN(AwContents); | 191 DISALLOW_COPY_AND_ASSIGN(AwContents); |
175 }; | 192 }; |
176 | 193 |
177 bool RegisterAwContents(JNIEnv* env); | 194 bool RegisterAwContents(JNIEnv* env); |
178 | 195 |
179 } // namespace android_webview | 196 } // namespace android_webview |
180 | 197 |
181 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ | 198 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ |
OLD | NEW |