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..a6deb05861f02640fe1e3ff32ce1b2c79dd251c6 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,47 @@ void AutofillManager::ShowAutofillSettings() { |
| manager_delegate_->ShowAutofillSettings(); |
| } |
| +bool AutofillManager::ShouldShowAccessMacContacts( |
| + const FormData& data, |
| + const FormFieldData& fieldData) { |
| + if (personal_data_->HasAccessMacContacts()) |
| + return false; |
| + |
| + for (auto it : form_structures_) { |
|
erikchen
2014/05/16 22:37:05
I couldn't find another way to get the type of the
|
| + // 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::AccessMacContacts() { |
| + personal_data_->AccessMacContacts(); |
| +} |
| + |
| bool AutofillManager::OnFormSubmitted(const FormData& form, |
| const TimeTicks& timestamp) { |
| if (!IsValidFormData(form)) |