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 "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_browser_main_parts.h" | 8 #include "android_webview/browser/aw_browser_main_parts.h" |
9 #include "android_webview/browser/gpu_memory_buffer_impl.h" | 9 #include "android_webview/browser/gpu_memory_buffer_impl.h" |
10 #include "android_webview/browser/in_process_view_renderer.h" | 10 #include "android_webview/browser/in_process_view_renderer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/android/jni_android.h" | 21 #include "base/android/jni_android.h" |
22 #include "base/android/jni_array.h" | 22 #include "base/android/jni_array.h" |
23 #include "base/android/jni_string.h" | 23 #include "base/android/jni_string.h" |
24 #include "base/android/scoped_java_ref.h" | 24 #include "base/android/scoped_java_ref.h" |
25 #include "base/bind.h" | 25 #include "base/bind.h" |
26 #include "base/callback.h" | 26 #include "base/callback.h" |
27 #include "base/message_loop.h" | 27 #include "base/message_loop.h" |
28 #include "base/pickle.h" | 28 #include "base/pickle.h" |
29 #include "base/strings/string16.h" | 29 #include "base/strings/string16.h" |
30 #include "base/supports_user_data.h" | 30 #include "base/supports_user_data.h" |
31 #include "components/autofill/browser/autofill_external_delegate.h" | |
32 #include "components/autofill/browser/autofill_manager.h" | 31 #include "components/autofill/browser/autofill_manager.h" |
33 #include "components/autofill/browser/webdata/autofill_webdata_service.h" | 32 #include "components/autofill/browser/webdata/autofill_webdata_service.h" |
| 33 #include "components/autofill/content/browser/autofill_driver_impl.h" |
34 #include "components/navigation_interception/intercept_navigation_delegate.h" | 34 #include "components/navigation_interception/intercept_navigation_delegate.h" |
35 #include "content/public/browser/android/content_view_core.h" | 35 #include "content/public/browser/android/content_view_core.h" |
36 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/cert_store.h" | 37 #include "content/public/browser/cert_store.h" |
38 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
39 #include "content/public/browser/render_process_host.h" | 39 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
42 #include "content/public/common/ssl_status.h" | 42 #include "content/public/common/ssl_status.h" |
43 #include "jni/AwContents_jni.h" | 43 #include "jni/AwContents_jni.h" |
44 #include "net/cert/x509_certificate.h" | 44 #include "net/cert/x509_certificate.h" |
45 #include "ui/base/l10n/l10n_util_android.h" | 45 #include "ui/base/l10n/l10n_util_android.h" |
46 #include "ui/gfx/android/java_bitmap.h" | 46 #include "ui/gfx/android/java_bitmap.h" |
47 | 47 |
48 struct AwDrawSWFunctionTable; | 48 struct AwDrawSWFunctionTable; |
49 struct AwDrawGLFunctionTable; | 49 struct AwDrawGLFunctionTable; |
50 | 50 |
51 using autofill::AutofillExternalDelegate; | 51 using autofill::AutofillDriverImpl; |
52 using autofill::AutofillManager; | 52 using autofill::AutofillManager; |
53 using base::android::AttachCurrentThread; | 53 using base::android::AttachCurrentThread; |
54 using base::android::ConvertJavaStringToUTF16; | 54 using base::android::ConvertJavaStringToUTF16; |
55 using base::android::ConvertJavaStringToUTF8; | 55 using base::android::ConvertJavaStringToUTF8; |
56 using base::android::ConvertUTF16ToJavaString; | 56 using base::android::ConvertUTF16ToJavaString; |
57 using base::android::ConvertUTF8ToJavaString; | 57 using base::android::ConvertUTF8ToJavaString; |
58 using base::android::JavaRef; | 58 using base::android::JavaRef; |
59 using base::android::ScopedJavaGlobalRef; | 59 using base::android::ScopedJavaGlobalRef; |
60 using base::android::ScopedJavaLocalRef; | 60 using base::android::ScopedJavaLocalRef; |
61 using navigation_interception::InterceptNavigationDelegate; | 61 using navigation_interception::InterceptNavigationDelegate; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 InterceptNavigationDelegate::Associate( | 172 InterceptNavigationDelegate::Associate( |
173 web_contents_.get(), | 173 web_contents_.get(), |
174 make_scoped_ptr(new InterceptNavigationDelegate( | 174 make_scoped_ptr(new InterceptNavigationDelegate( |
175 env, intercept_navigation_delegate))); | 175 env, intercept_navigation_delegate))); |
176 } | 176 } |
177 | 177 |
178 void AwContents::SetSaveFormData(bool enabled) { | 178 void AwContents::SetSaveFormData(bool enabled) { |
179 InitAutofillIfNecessary(enabled); | 179 InitAutofillIfNecessary(enabled); |
180 // We need to check for the existence, since autofill_manager_delegate | 180 // We need to check for the existence, since autofill_manager_delegate |
181 // may not be created when the setting is false. | 181 // may not be created when the setting is false. |
182 if (AutofillManager::FromWebContents(web_contents_.get())) { | 182 if (AutofillDriverImpl::FromWebContents(web_contents_.get())) { |
183 AwAutofillManagerDelegate* autofill_manager_delegate = | 183 AwAutofillManagerDelegate* autofill_manager_delegate = |
184 AwBrowserContext::FromWebContents(web_contents_.get())-> | 184 AwBrowserContext::FromWebContents(web_contents_.get())-> |
185 AutofillManagerDelegate(); | 185 AutofillManagerDelegate(); |
186 autofill_manager_delegate->SetSaveFormData(enabled); | 186 autofill_manager_delegate->SetSaveFormData(enabled); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 void AwContents::InitAutofillIfNecessary(bool enabled) { | 190 void AwContents::InitAutofillIfNecessary(bool enabled) { |
191 // Do not initialize if the feature is not enabled. | 191 // Do not initialize if the feature is not enabled. |
192 if (!enabled) | 192 if (!enabled) |
193 return; | 193 return; |
194 // Check if the autofill manager already exists. | 194 // Check if the autofill manager already exists. |
195 content::WebContents* web_contents = web_contents_.get(); | 195 content::WebContents* web_contents = web_contents_.get(); |
196 if (AutofillManager::FromWebContents(web_contents)) | 196 if (AutofillDriverImpl::FromWebContents(web_contents)) |
197 return; | 197 return; |
198 | 198 |
199 AutofillManager::CreateForWebContentsAndDelegate( | 199 AutofillDriverImpl::CreateForWebContentsAndDelegate( |
200 web_contents, | 200 web_contents, |
201 AwBrowserContext::FromWebContents(web_contents)-> | 201 AwBrowserContext::FromWebContents(web_contents)-> |
202 CreateAutofillManagerDelegate(enabled), | 202 CreateAutofillManagerDelegate(enabled), |
203 l10n_util::GetDefaultLocale(), | 203 l10n_util::GetDefaultLocale(), |
204 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); | 204 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER, |
205 AutofillManager* autofill_manager = | 205 true); |
206 AutofillManager::FromWebContents(web_contents); | |
207 AutofillExternalDelegate::CreateForWebContentsAndManager( | |
208 web_contents, | |
209 autofill_manager); | |
210 autofill_manager->SetExternalDelegate( | |
211 AutofillExternalDelegate::FromWebContents(web_contents)); | |
212 } | 206 } |
213 | 207 |
214 AwContents::~AwContents() { | 208 AwContents::~AwContents() { |
215 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); | 209 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); |
216 web_contents_->RemoveUserData(kAwContentsUserDataKey); | 210 web_contents_->RemoveUserData(kAwContentsUserDataKey); |
217 if (find_helper_.get()) | 211 if (find_helper_.get()) |
218 find_helper_->SetListener(NULL); | 212 find_helper_->SetListener(NULL); |
219 if (icon_helper_.get()) | 213 if (icon_helper_.get()) |
220 icon_helper_->SetListener(NULL); | 214 icon_helper_->SetListener(NULL); |
221 } | 215 } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 return browser_view_renderer_->CapturePicture(); | 689 return browser_view_renderer_->CapturePicture(); |
696 } | 690 } |
697 | 691 |
698 void AwContents::EnableOnNewPicture(JNIEnv* env, | 692 void AwContents::EnableOnNewPicture(JNIEnv* env, |
699 jobject obj, | 693 jobject obj, |
700 jboolean enabled) { | 694 jboolean enabled) { |
701 browser_view_renderer_->EnableOnNewPicture(enabled); | 695 browser_view_renderer_->EnableOnNewPicture(enabled); |
702 } | 696 } |
703 | 697 |
704 } // namespace android_webview | 698 } // namespace android_webview |
OLD | NEW |