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