| 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/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 10 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
| 11 #include "android_webview/common/aw_hit_test_data.h" | 11 #include "android_webview/common/aw_hit_test_data.h" |
| 12 #include "android_webview/native/aw_browser_dependency_factory.h" | 12 #include "android_webview/native/aw_browser_dependency_factory.h" |
| 13 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 13 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 14 #include "android_webview/native/aw_web_contents_delegate.h" | 14 #include "android_webview/native/aw_web_contents_delegate.h" |
| 15 #include "android_webview/native/state_serializer.h" | 15 #include "android_webview/native/state_serializer.h" |
| 16 #include "base/android/jni_android.h" | 16 #include "base/android/jni_android.h" |
| 17 #include "base/android/jni_array.h" | 17 #include "base/android/jni_array.h" |
| 18 #include "base/android/jni_string.h" | 18 #include "base/android/jni_string.h" |
| 19 #include "base/bind.h" | 19 #include "base/bind.h" |
| 20 #include "base/callback.h" | 20 #include "base/callback.h" |
| 21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
| 22 #include "base/pickle.h" | 22 #include "base/pickle.h" |
| 23 #include "base/supports_user_data.h" | 23 #include "base/supports_user_data.h" |
| 24 #include "cc/layer.h" |
| 24 #include "content/components/navigation_interception/intercept_navigation_delega
te.h" | 25 #include "content/components/navigation_interception/intercept_navigation_delega
te.h" |
| 25 #include "content/public/browser/android/content_view_core.h" | 26 #include "content/public/browser/android/content_view_core.h" |
| 26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/cert_store.h" | 28 #include "content/public/browser/cert_store.h" |
| 28 #include "content/public/browser/navigation_entry.h" | 29 #include "content/public/browser/navigation_entry.h" |
| 29 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/common/ssl_status.h" | 32 #include "content/public/common/ssl_status.h" |
| 32 #include "jni/AwContents_jni.h" | 33 #include "jni/AwContents_jni.h" |
| 33 #include "net/base/x509_certificate.h" | 34 #include "net/base/x509_certificate.h" |
| 35 #include "ui/gfx/transform.h" |
| 34 | 36 |
| 35 using base::android::AttachCurrentThread; | 37 using base::android::AttachCurrentThread; |
| 36 using base::android::ConvertJavaStringToUTF16; | 38 using base::android::ConvertJavaStringToUTF16; |
| 37 using base::android::ConvertJavaStringToUTF8; | 39 using base::android::ConvertJavaStringToUTF8; |
| 38 using base::android::ConvertUTF16ToJavaString; | 40 using base::android::ConvertUTF16ToJavaString; |
| 39 using base::android::ConvertUTF8ToJavaString; | 41 using base::android::ConvertUTF8ToJavaString; |
| 40 using base::android::JavaRef; | 42 using base::android::JavaRef; |
| 41 using base::android::ScopedJavaGlobalRef; | 43 using base::android::ScopedJavaGlobalRef; |
| 42 using base::android::ScopedJavaLocalRef; | 44 using base::android::ScopedJavaLocalRef; |
| 43 using content::BrowserThread; | 45 using content::BrowserThread; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 // Work-around for http://crbug.com/161864. TODO(joth): Remove this class when | 84 // Work-around for http://crbug.com/161864. TODO(joth): Remove this class when |
| 83 // that bug is closed. | 85 // that bug is closed. |
| 84 class NullCompositor : public content::Compositor { | 86 class NullCompositor : public content::Compositor { |
| 85 public: | 87 public: |
| 86 NullCompositor() {} | 88 NullCompositor() {} |
| 87 virtual ~NullCompositor() {} | 89 virtual ~NullCompositor() {} |
| 88 | 90 |
| 89 // Compositor | 91 // Compositor |
| 90 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE {} | 92 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE {} |
| 91 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {} | 93 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {} |
| 92 virtual void SetVisible(bool visible) OVERRIDE {} | 94 virtual void SetVisible(bool visible) OVERRIDE {} |
| 93 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {} | 95 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {} |
| 94 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) | 96 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) |
| 95 OVERRIDE { | 97 OVERRIDE { |
| 96 return false; | 98 return false; |
| 97 } | 99 } |
| 98 virtual void Composite() {} | 100 virtual void Composite() {} |
| 99 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE { | 101 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE { |
| 100 return 0; | 102 return 0; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 185 } |
| 184 | 186 |
| 185 jint AwContents::GetWebContents(JNIEnv* env, jobject obj) { | 187 jint AwContents::GetWebContents(JNIEnv* env, jobject obj) { |
| 186 return reinterpret_cast<jint>(web_contents_.get()); | 188 return reinterpret_cast<jint>(web_contents_.get()); |
| 187 } | 189 } |
| 188 | 190 |
| 189 void AwContents::DidInitializeContentViewCore(JNIEnv* env, jobject obj, | 191 void AwContents::DidInitializeContentViewCore(JNIEnv* env, jobject obj, |
| 190 jint content_view_core) { | 192 jint content_view_core) { |
| 191 ContentViewCore* core = reinterpret_cast<ContentViewCore*>(content_view_core); | 193 ContentViewCore* core = reinterpret_cast<ContentViewCore*>(content_view_core); |
| 192 DCHECK(core == ContentViewCore::FromWebContents(web_contents_.get())); | 194 DCHECK(core == ContentViewCore::FromWebContents(web_contents_.get())); |
| 193 compositor_->SetRootLayer(core->GetWebLayer()); | 195 compositor_->SetRootLayer(core->GetLayer()); |
| 194 Invalidate(); | 196 Invalidate(); |
| 195 } | 197 } |
| 196 | 198 |
| 197 void AwContents::Destroy(JNIEnv* env, jobject obj) { | 199 void AwContents::Destroy(JNIEnv* env, jobject obj) { |
| 198 delete this; | 200 delete this; |
| 199 } | 201 } |
| 200 | 202 |
| 201 // static | 203 // static |
| 202 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { | 204 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { |
| 203 return reinterpret_cast<jint>(&DrawGLFunction); | 205 return reinterpret_cast<jint>(&DrawGLFunction); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 return; | 539 return; |
| 538 } | 540 } |
| 539 pending_contents_ = pending.Pass(); | 541 pending_contents_ = pending.Pass(); |
| 540 } | 542 } |
| 541 | 543 |
| 542 jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { | 544 jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { |
| 543 return reinterpret_cast<jint>(pending_contents_.release()); | 545 return reinterpret_cast<jint>(pending_contents_.release()); |
| 544 } | 546 } |
| 545 | 547 |
| 546 } // namespace android_webview | 548 } // namespace android_webview |
| OLD | NEW |