Chromium Code Reviews| Index: components/autofill/core/browser/autofill_manager.cc |
| diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc |
| index 4c42479084aa4732c13e1457d04d75277419bf95..eb4cd61c87787ca67b0e1a7727fd7969ae0cabe8 100644 |
| --- a/components/autofill/core/browser/autofill_manager.cc |
| +++ b/components/autofill/core/browser/autofill_manager.cc |
| @@ -30,6 +30,7 @@ |
| #include "components/autofill/core/browser/autofill_profile.h" |
| #include "components/autofill/core/browser/autofill_type.h" |
| #include "components/autofill/core/browser/credit_card.h" |
| +#include "components/autofill/core/browser/field_types.h" |
| #include "components/autofill/core/browser/form_structure.h" |
| #include "components/autofill/core/browser/personal_data_manager.h" |
| #include "components/autofill/core/browser/phone_number.h" |
| @@ -240,6 +241,56 @@ void AutofillManager::ShowAutofillSettings() { |
| manager_delegate_->ShowAutofillSettings(); |
| } |
| +#if defined(OS_MACOSX) |
| +bool AutofillManager::HasPromptedForAccessToAddressBook() { |
| + // Return 'true' to prevent the UI from prompting the user for access to the |
| + // address book again. |
| + if (!personal_data_) |
| + return true; |
| + return personal_data_->HasPromptedForAccessToAddressBook(); |
| +} |
| + |
| +bool AutofillManager::FieldSupportsAddressBookAutofill( |
| + const FormData& data, |
| + const FormFieldData& fieldData) { |
|
Ilya Sherman
2014/05/21 11:29:15
nit: "fieldData" -> "field" or "field_data"
erikchen
2014/05/21 22:00:54
ack, thanks. I've been writing too much ObjC.
|
| + for (auto it : form_structures_) { |
|
Ilya Sherman
2014/05/21 11:29:15
C++ files should not use auto. It's fine to keep
erikchen
2014/05/21 22:00:54
I've moved this logic into personal_data_manager_m
Ilya Sherman
2014/05/22 15:13:59
Chromium in general still supports non C++11 compl
|
| + // The form does not match. |
| + if (it->ToFormData().name != data.name) |
| + continue; |
| + for (size_t index = 0; index < it->field_count(); ++index) { |
| + const AutofillField* field = it->field(index); |
| + // The field does not match. |
| + if (field->name != fieldData.name) |
| + continue; |
| + |
| + switch (field->Type().group()) { |
| + case ADDRESS_BILLING: |
| + case ADDRESS_HOME: |
| + case EMAIL: |
| + case NAME: |
| + case NAME_BILLING: |
| + case PHONE_BILLING: |
| + case PHONE_HOME: |
| + return true; |
| + case NO_GROUP: |
| + case COMPANY: |
| + case CREDIT_CARD: |
| + case PASSWORD_FIELD: |
| + return false; |
| + } |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| +void AutofillManager::AccessAddressBook() { |
| + if (!personal_data_) |
| + return; |
| + personal_data_->AccessAddressBook(); |
| +} |
| +#endif // defined(OS_MACOSX) |
|
Ilya Sherman
2014/05/21 11:29:15
I'd prefer to not make any changes to the Autofill
erikchen
2014/05/21 22:00:54
The method ShouldShowAccessAddressBookSuggestion n
|
| + |
| bool AutofillManager::OnFormSubmitted(const FormData& form, |
| const TimeTicks& timestamp) { |
| if (!IsValidFormData(form)) |