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 #include "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_main_parts.h" | 7 #include "android_webview/browser/aw_browser_main_parts.h" |
8 #include "android_webview/browser/net_disk_cache_remover.h" | 8 #include "android_webview/browser/net_disk_cache_remover.h" |
9 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 9 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
10 #include "android_webview/common/aw_hit_test_data.h" | 10 #include "android_webview/common/aw_hit_test_data.h" |
11 #include "android_webview/native/aw_browser_dependency_factory.h" | 11 #include "android_webview/native/aw_browser_dependency_factory.h" |
12 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 12 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
13 #include "android_webview/native/aw_web_contents_delegate.h" | 13 #include "android_webview/native/aw_web_contents_delegate.h" |
14 #include "android_webview/native/state_serializer.h" | 14 #include "android_webview/native/state_serializer.h" |
15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
16 #include "base/android/jni_array.h" | 16 #include "base/android/jni_array.h" |
17 #include "base/android/jni_string.h" | 17 #include "base/android/jni_string.h" |
18 #include "base/bind.h" | 18 #include "base/bind.h" |
19 #include "base/callback.h" | 19 #include "base/callback.h" |
20 #include "base/pickle.h" | 20 #include "base/pickle.h" |
21 #include "base/supports_user_data.h" | 21 #include "base/supports_user_data.h" |
| 22 #include "cc/layer.h" |
22 #include "content/components/navigation_interception/intercept_navigation_delega
te.h" | 23 #include "content/components/navigation_interception/intercept_navigation_delega
te.h" |
23 #include "content/public/browser/android/content_view_core.h" | 24 #include "content/public/browser/android/content_view_core.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/cert_store.h" | 26 #include "content/public/browser/cert_store.h" |
26 #include "content/public/browser/navigation_entry.h" | 27 #include "content/public/browser/navigation_entry.h" |
27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
28 #include "content/public/common/ssl_status.h" | 29 #include "content/public/common/ssl_status.h" |
29 #include "jni/AwContents_jni.h" | 30 #include "jni/AwContents_jni.h" |
30 #include "net/base/x509_certificate.h" | 31 #include "net/base/x509_certificate.h" |
| 32 #include "ui/gfx/transform.h" |
31 | 33 |
32 using base::android::AttachCurrentThread; | 34 using base::android::AttachCurrentThread; |
33 using base::android::ConvertJavaStringToUTF16; | 35 using base::android::ConvertJavaStringToUTF16; |
34 using base::android::ConvertJavaStringToUTF8; | 36 using base::android::ConvertJavaStringToUTF8; |
35 using base::android::ConvertUTF16ToJavaString; | 37 using base::android::ConvertUTF16ToJavaString; |
36 using base::android::ConvertUTF8ToJavaString; | 38 using base::android::ConvertUTF8ToJavaString; |
37 using base::android::JavaRef; | 39 using base::android::JavaRef; |
38 using base::android::ScopedJavaGlobalRef; | 40 using base::android::ScopedJavaGlobalRef; |
39 using base::android::ScopedJavaLocalRef; | 41 using base::android::ScopedJavaLocalRef; |
| 42 using cc::Layer; |
40 using content::BrowserThread; | 43 using content::BrowserThread; |
41 using content::ContentViewCore; | 44 using content::ContentViewCore; |
42 using content::InterceptNavigationDelegate; | 45 using content::InterceptNavigationDelegate; |
43 using content::WebContents; | 46 using content::WebContents; |
44 | 47 |
45 extern "C" { | 48 extern "C" { |
46 static AwDrawGLFunction DrawGLFunction; | 49 static AwDrawGLFunction DrawGLFunction; |
47 static void DrawGLFunction(int view_context, | 50 static void DrawGLFunction(int view_context, |
48 AwDrawGLInfo* draw_info, | 51 AwDrawGLInfo* draw_info, |
49 void* spare) { | 52 void* spare) { |
(...skipping 27 matching lines...) Expand all Loading... |
77 }; | 80 }; |
78 | 81 |
79 // Work-around for http://crbug.com/161864. TODO(joth): Remove this class when | 82 // Work-around for http://crbug.com/161864. TODO(joth): Remove this class when |
80 // that bug is closed. | 83 // that bug is closed. |
81 class NullCompositor : public content::Compositor { | 84 class NullCompositor : public content::Compositor { |
82 public: | 85 public: |
83 NullCompositor() {} | 86 NullCompositor() {} |
84 virtual ~NullCompositor() {} | 87 virtual ~NullCompositor() {} |
85 | 88 |
86 // Compositor | 89 // Compositor |
87 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE {} | 90 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE {} |
88 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {} | 91 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {} |
89 virtual void SetVisible(bool visible) OVERRIDE {} | 92 virtual void SetVisible(bool visible) OVERRIDE {} |
90 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {} | 93 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {} |
91 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) | 94 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) |
92 OVERRIDE { | 95 OVERRIDE { |
93 return false; | 96 return false; |
94 } | 97 } |
95 virtual void Composite() {} | 98 virtual void Composite() {} |
96 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE { | 99 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE { |
97 return 0; | 100 return 0; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 167 } |
165 | 168 |
166 jint AwContents::GetWebContents(JNIEnv* env, jobject obj) { | 169 jint AwContents::GetWebContents(JNIEnv* env, jobject obj) { |
167 return reinterpret_cast<jint>(web_contents_.get()); | 170 return reinterpret_cast<jint>(web_contents_.get()); |
168 } | 171 } |
169 | 172 |
170 void AwContents::DidInitializeContentViewCore(JNIEnv* env, jobject obj, | 173 void AwContents::DidInitializeContentViewCore(JNIEnv* env, jobject obj, |
171 jint content_view_core) { | 174 jint content_view_core) { |
172 ContentViewCore* core = reinterpret_cast<ContentViewCore*>(content_view_core); | 175 ContentViewCore* core = reinterpret_cast<ContentViewCore*>(content_view_core); |
173 DCHECK(core == ContentViewCore::FromWebContents(web_contents_.get())); | 176 DCHECK(core == ContentViewCore::FromWebContents(web_contents_.get())); |
174 compositor_->SetRootLayer(core->GetWebLayer()); | 177 compositor_->SetRootLayer(core->GetLayer()); |
175 } | 178 } |
176 | 179 |
177 void AwContents::Destroy(JNIEnv* env, jobject obj) { | 180 void AwContents::Destroy(JNIEnv* env, jobject obj) { |
178 delete this; | 181 delete this; |
179 } | 182 } |
180 | 183 |
181 // static | 184 // static |
182 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { | 185 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { |
183 return reinterpret_cast<jint>(&DrawGLFunction); | 186 return reinterpret_cast<jint>(&DrawGLFunction); |
184 } | 187 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 base::android::JavaByteArrayToByteVector(env, state, &state_vector); | 486 base::android::JavaByteArrayToByteVector(env, state, &state_vector); |
484 | 487 |
485 Pickle pickle(reinterpret_cast<const char*>(state_vector.begin()), | 488 Pickle pickle(reinterpret_cast<const char*>(state_vector.begin()), |
486 state_vector.size()); | 489 state_vector.size()); |
487 PickleIterator iterator(pickle); | 490 PickleIterator iterator(pickle); |
488 | 491 |
489 return RestoreFromPickle(&iterator, web_contents_.get()); | 492 return RestoreFromPickle(&iterator, web_contents_.get()); |
490 } | 493 } |
491 | 494 |
492 } // namespace android_webview | 495 } // namespace android_webview |
OLD | NEW |