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

Unified Diff: components/autofill/browser/autofill_manager.cc

Issue 16212007: Implement the autofill UI for chromium powered android webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue15097004
Patch Set: introduced java peer to AwAutofillManagerDelegate Created 7 years, 6 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: components/autofill/browser/autofill_manager.cc
diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc
index 6ecf9e934fd1580ccae0724bb6c855f80c97de97..2cc8624af0383c09fdcd5d1e6a924d47e6ad44a8 100644
--- a/components/autofill/browser/autofill_manager.cc
+++ b/components/autofill/browser/autofill_manager.cc
@@ -409,6 +409,7 @@ bool AutofillManager::OnFormSubmitted(const FormData& form,
void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
const TimeTicks& timestamp,
autofill::FormsSeenState state) {
+
bool is_post_document_load = state == autofill::DYNAMIC_FORMS_SEEN;
bool has_more_forms = state == autofill::PARTIAL_FORMS_SEEN;
// If new forms were added via AJAX or DHML, treat as new page.
@@ -438,7 +439,6 @@ void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled);
has_logged_autofill_enabled_ = true;
}
-
if (!enabled)
return;
@@ -519,7 +519,8 @@ void AutofillManager::GetAutofillSuggestions(
RenderViewHost* host = NULL;
FormStructure* form_structure = NULL;
AutofillField* autofill_field = NULL;
- if (GetHost(&host) &&
+ if (personal_data_ &&
+ GetHost(&host) &&
GetCachedFormAndField(form, field, &form_structure, &autofill_field) &&
// Don't send suggestions for forms that aren't auto-fillable.
form_structure->IsAutofillable(false)) {
@@ -716,6 +717,10 @@ void AutofillManager::OnHideAutofillUi() {
}
void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) {
+
+ if (!personal_data_)
+ return;
+
const AutofillDataModel* data_model = NULL;
size_t variant = 0;
if (!GetProfileOrCreditCard(unique_id, &data_model, &variant)) {
@@ -795,6 +800,7 @@ void AutofillManager::OnSetDataList(const std::vector<base::string16>& values,
void AutofillManager::OnRequestAutocomplete(
const FormData& form,
const GURL& frame_url) {
+
if (!IsAutofillEnabled()) {
ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled,
FormData());
@@ -966,7 +972,7 @@ void AutofillManager::OnMaybeShowAutocheckoutBubble(
}
void AutofillManager::UploadFormData(const FormStructure& submitted_form) {
- if (!download_manager_)
+ if (!download_manager_ || !personal_data_)
return;
// Check if the form is among the forms that were recently auto-filled.
@@ -1038,7 +1044,8 @@ bool AutofillManager::GetHost(RenderViewHost** host) const {
return false;
// No autofill data to return if the profiles are empty.
- if (personal_data_->GetProfiles().empty() &&
+ if (personal_data_ &&
+ personal_data_->GetProfiles().empty() &&
personal_data_->GetCreditCards().empty()) {
return false;
}
@@ -1054,6 +1061,9 @@ bool AutofillManager::GetProfileOrCreditCard(
int unique_id,
const AutofillDataModel** data_model,
size_t* variant) const {
+ if (!personal_data_)
+ return false;
+
// Unpack the |unique_id| into component parts.
GUIDPair credit_card_guid;
GUIDPair profile_guid;
@@ -1203,6 +1213,9 @@ void AutofillManager::GetProfileSuggestions(
std::vector<base::string16>* labels,
std::vector<base::string16>* icons,
std::vector<int>* unique_ids) const {
+
+ if (!personal_data_)
+ return;
std::vector<AutofillFieldType> field_types(form->field_count());
for (size_t i = 0; i < form->field_count(); ++i) {
field_types[i] = form->field(i)->type();
@@ -1226,6 +1239,10 @@ void AutofillManager::GetCreditCardSuggestions(
std::vector<base::string16>* labels,
std::vector<base::string16>* icons,
std::vector<int>* unique_ids) const {
+
+ if (!personal_data_)
+ return;
+
std::vector<GUIDPair> guid_pairs;
personal_data_->GetCreditCardSuggestions(
type, field.value, values, labels, icons, &guid_pairs);

Powered by Google App Engine
This is Rietveld 408576698