Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2526)

Unified Diff: android_webview/native/aw_contents.cc

Issue 15097004: Enable Autocomplete feature for chromium webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setSaveFormData2
Patch Set: make personal_data_ optional Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 22675f8790df7edbc80509aa7c144f6f87029c78..723e04da8d8a0f9875d608c521cc5352ae8f311f 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -4,6 +4,7 @@
#include "android_webview/native/aw_contents.h"
+#include "android_webview/browser/aw_autofill_external_delegate.h"
#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/browser/aw_browser_main_parts.h"
#include "android_webview/browser/browser_view_renderer_impl.h"
@@ -28,7 +29,6 @@
#include "base/pickle.h"
#include "base/string16.h"
#include "base/supports_user_data.h"
-#include "components/autofill/browser/autofill_external_delegate.h"
#include "components/autofill/browser/autofill_manager.h"
#include "components/autofill/browser/webdata/autofill_webdata_service.h"
#include "components/navigation_interception/intercept_navigation_delegate.h"
@@ -48,7 +48,6 @@
struct AwDrawSWFunctionTable;
struct AwDrawGLFunctionTable;
-using autofill::AutofillExternalDelegate;
using autofill::AutofillManager;
using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF16;
@@ -154,46 +153,43 @@ void AwContents::SetWebContents(content::WebContents* web_contents) {
new AwRenderViewHostExt(this, web_contents_.get()));
AwAutofillManagerDelegate* autofill_manager_delegate =
- AwBrowserContext::FromWebContents(web_contents_.get())->
- AutofillManagerDelegate();
+ AwAutofillManagerDelegate::FromWebContents(web_contents_.get());
if (autofill_manager_delegate)
InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
}
void AwContents::SetSaveFormData(bool enabled) {
InitAutofillIfNecessary(enabled);
- // We need to check for the existence, since autofill_manager_delegate
- // may not be created when the setting is false.
- if (AutofillManager::FromWebContents(web_contents_.get())) {
- AwAutofillManagerDelegate* autofill_manager_delegate =
- AwBrowserContext::FromWebContents(web_contents_.get())->
- AutofillManagerDelegate();
- autofill_manager_delegate->SetSaveFormData(enabled);
- }
+ AwAutofillManagerDelegate::FromWebContents(web_contents_.get())->
+ SetSaveFormData(enabled);
}
void AwContents::InitAutofillIfNecessary(bool enabled) {
// Do not initialize if the feature is not enabled.
if (!enabled)
return;
- // Check if the autofill manager already exists.
+
content::WebContents* web_contents = web_contents_.get();
if (AutofillManager::FromWebContents(web_contents))
return;
+ AwBrowserContext::FromWebContents(web_contents)->
+ CreateUserPrefServiceIfNecessary();
+
+ AwAutofillManagerDelegate::CreateForWebContents(web_contents);
+
AutofillManager::CreateForWebContentsAndDelegate(
web_contents,
- AwBrowserContext::FromWebContents(web_contents)->
- CreateAutofillManagerDelegate(enabled),
+ AwAutofillManagerDelegate::FromWebContents(web_contents),
l10n_util::GetDefaultLocale(),
AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
AutofillManager* autofill_manager =
AutofillManager::FromWebContents(web_contents);
- AutofillExternalDelegate::CreateForWebContentsAndManager(
+ AwAutofillExternalDelegate::CreateForWebContentsAndManager(
benm (inactive) 2013/05/23 12:02:21 nit: move this consctruction into the setter below
sgurun-gerrit only 2013/05/23 17:10:01 not sure if I understand right (I did not have a m
web_contents,
autofill_manager);
autofill_manager->SetExternalDelegate(
- AutofillExternalDelegate::FromWebContents(web_contents));
+ AwAutofillExternalDelegate::FromWebContents(web_contents));
}
void AwContents::SetWebContents(JNIEnv* env, jobject obj, jint new_wc) {

Powered by Google App Engine
This is Rietveld 408576698