| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "base/android/locale_utils.h" | 37 #include "base/android/locale_utils.h" |
| 38 #include "base/android/scoped_java_ref.h" | 38 #include "base/android/scoped_java_ref.h" |
| 39 #include "base/atomicops.h" | 39 #include "base/atomicops.h" |
| 40 #include "base/bind.h" | 40 #include "base/bind.h" |
| 41 #include "base/callback.h" | 41 #include "base/callback.h" |
| 42 #include "base/memory/memory_pressure_listener.h" | 42 #include "base/memory/memory_pressure_listener.h" |
| 43 #include "base/message_loop/message_loop.h" | 43 #include "base/message_loop/message_loop.h" |
| 44 #include "base/pickle.h" | 44 #include "base/pickle.h" |
| 45 #include "base/strings/string16.h" | 45 #include "base/strings/string16.h" |
| 46 #include "base/supports_user_data.h" | 46 #include "base/supports_user_data.h" |
| 47 #include "components/autofill/content/browser/content_autofill_driver.h" | 47 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 48 #include "components/autofill/core/browser/autofill_manager.h" | 48 #include "components/autofill/core/browser/autofill_manager.h" |
| 49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 51 #include "components/navigation_interception/intercept_navigation_delegate.h" | 51 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 52 #include "content/public/browser/android/content_view_core.h" | 52 #include "content/public/browser/android/content_view_core.h" |
| 53 #include "content/public/browser/android/synchronous_compositor.h" | 53 #include "content/public/browser/android/synchronous_compositor.h" |
| 54 #include "content/public/browser/browser_thread.h" | 54 #include "content/public/browser/browser_thread.h" |
| 55 #include "content/public/browser/cert_store.h" | 55 #include "content/public/browser/cert_store.h" |
| 56 #include "content/public/browser/favicon_status.h" | 56 #include "content/public/browser/favicon_status.h" |
| 57 #include "content/public/browser/message_port_provider.h" | 57 #include "content/public/browser/message_port_provider.h" |
| 58 #include "content/public/browser/navigation_entry.h" | 58 #include "content/public/browser/navigation_entry.h" |
| 59 #include "content/public/browser/render_frame_host.h" | 59 #include "content/public/browser/render_frame_host.h" |
| 60 #include "content/public/browser/render_process_host.h" | 60 #include "content/public/browser/render_process_host.h" |
| 61 #include "content/public/browser/render_view_host.h" | 61 #include "content/public/browser/render_view_host.h" |
| 62 #include "content/public/browser/web_contents.h" | 62 #include "content/public/browser/web_contents.h" |
| 63 #include "content/public/common/renderer_preferences.h" | 63 #include "content/public/common/renderer_preferences.h" |
| 64 #include "content/public/common/ssl_status.h" | 64 #include "content/public/common/ssl_status.h" |
| 65 #include "jni/AwContents_jni.h" | 65 #include "jni/AwContents_jni.h" |
| 66 #include "net/base/auth.h" | 66 #include "net/base/auth.h" |
| 67 #include "net/cert/x509_certificate.h" | 67 #include "net/cert/x509_certificate.h" |
| 68 #include "third_party/skia/include/core/SkPicture.h" | 68 #include "third_party/skia/include/core/SkPicture.h" |
| 69 #include "ui/gfx/android/java_bitmap.h" | 69 #include "ui/gfx/android/java_bitmap.h" |
| 70 #include "ui/gfx/geometry/rect_f.h" | 70 #include "ui/gfx/geometry/rect_f.h" |
| 71 #include "ui/gfx/image/image.h" | 71 #include "ui/gfx/image/image.h" |
| 72 #include "ui/gfx/size.h" | 72 #include "ui/gfx/size.h" |
| 73 | 73 |
| 74 struct AwDrawSWFunctionTable; | 74 struct AwDrawSWFunctionTable; |
| 75 | 75 |
| 76 using autofill::ContentAutofillDriver; | 76 using autofill::ContentAutofillDriverFactory; |
| 77 using autofill::AutofillManager; | 77 using autofill::AutofillManager; |
| 78 using base::android::AttachCurrentThread; | 78 using base::android::AttachCurrentThread; |
| 79 using base::android::ConvertJavaStringToUTF16; | 79 using base::android::ConvertJavaStringToUTF16; |
| 80 using base::android::ConvertJavaStringToUTF8; | 80 using base::android::ConvertJavaStringToUTF8; |
| 81 using base::android::ConvertUTF16ToJavaString; | 81 using base::android::ConvertUTF16ToJavaString; |
| 82 using base::android::ConvertUTF8ToJavaString; | 82 using base::android::ConvertUTF8ToJavaString; |
| 83 using base::android::JavaRef; | 83 using base::android::JavaRef; |
| 84 using base::android::ScopedJavaGlobalRef; | 84 using base::android::ScopedJavaGlobalRef; |
| 85 using base::android::ScopedJavaLocalRef; | 85 using base::android::ScopedJavaLocalRef; |
| 86 using data_reduction_proxy::DataReductionProxySettings; | 86 using data_reduction_proxy::DataReductionProxySettings; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // Finally, having setup the associations, release any deferred requests | 236 // Finally, having setup the associations, release any deferred requests |
| 237 web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady)); | 237 web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void AwContents::SetSaveFormData(bool enabled) { | 240 void AwContents::SetSaveFormData(bool enabled) { |
| 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 242 InitAutofillIfNecessary(enabled); | 242 InitAutofillIfNecessary(enabled); |
| 243 // We need to check for the existence, since autofill_manager_delegate | 243 // We need to check for the existence, since autofill_manager_delegate |
| 244 // may not be created when the setting is false. | 244 // may not be created when the setting is false. |
| 245 if (ContentAutofillDriver::FromWebContents(web_contents_.get())) { | 245 if (AwAutofillClient::FromWebContents(web_contents_.get())) { |
| 246 AwAutofillClient::FromWebContents(web_contents_.get())-> | 246 AwAutofillClient::FromWebContents(web_contents_.get())-> |
| 247 SetSaveFormData(enabled); | 247 SetSaveFormData(enabled); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 void AwContents::InitDataReductionProxyIfNecessary() { | 251 void AwContents::InitDataReductionProxyIfNecessary() { |
| 252 AwBrowserContext* browser_context = | 252 AwBrowserContext* browser_context = |
| 253 AwBrowserContext::FromWebContents(web_contents_.get()); | 253 AwBrowserContext::FromWebContents(web_contents_.get()); |
| 254 browser_context->CreateUserPrefServiceIfNecessary(); | 254 browser_context->CreateUserPrefServiceIfNecessary(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void AwContents::InitAutofillIfNecessary(bool enabled) { | 257 void AwContents::InitAutofillIfNecessary(bool enabled) { |
| 258 // Do not initialize if the feature is not enabled. | 258 // Do not initialize if the feature is not enabled. |
| 259 if (!enabled) | 259 if (!enabled) |
| 260 return; | 260 return; |
| 261 // Check if the autofill driver already exists. | 261 // Check if the autofill driver factory already exists. |
| 262 content::WebContents* web_contents = web_contents_.get(); | 262 content::WebContents* web_contents = web_contents_.get(); |
| 263 if (ContentAutofillDriver::FromWebContents(web_contents)) | 263 if (ContentAutofillDriverFactory::FromWebContents(web_contents)) |
| 264 return; | 264 return; |
| 265 | 265 |
| 266 AwBrowserContext::FromWebContents(web_contents)-> | 266 AwBrowserContext::FromWebContents(web_contents)-> |
| 267 CreateUserPrefServiceIfNecessary(); | 267 CreateUserPrefServiceIfNecessary(); |
| 268 AwAutofillClient::CreateForWebContents(web_contents); | 268 AwAutofillClient::CreateForWebContents(web_contents); |
| 269 ContentAutofillDriver::CreateForWebContentsAndDelegate( | 269 ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( |
| 270 web_contents, | 270 web_contents, AwAutofillClient::FromWebContents(web_contents), |
| 271 AwAutofillClient::FromWebContents(web_contents), | |
| 272 base::android::GetDefaultLocale(), | 271 base::android::GetDefaultLocale(), |
| 273 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); | 272 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); |
| 274 } | 273 } |
| 275 | 274 |
| 276 void AwContents::SetAwAutofillClient(jobject client) { | 275 void AwContents::SetAwAutofillClient(jobject client) { |
| 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 278 JNIEnv* env = AttachCurrentThread(); | 277 JNIEnv* env = AttachCurrentThread(); |
| 279 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 278 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 280 if (obj.is_null()) | 279 if (obj.is_null()) |
| 281 return; | 280 return; |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 base::Owned(port1), | 1120 base::Owned(port1), |
| 1122 base::Owned(port2))); | 1121 base::Owned(port2))); |
| 1123 } | 1122 } |
| 1124 | 1123 |
| 1125 | 1124 |
| 1126 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1125 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1127 g_should_download_favicons = true; | 1126 g_should_download_favicons = true; |
| 1128 } | 1127 } |
| 1129 | 1128 |
| 1130 } // namespace android_webview | 1129 } // namespace android_webview |
| OLD | NEW |