OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // work if the delegate has a pointer to the AutofillManager, but | 233 // work if the delegate has a pointer to the AutofillManager, but |
234 // future directions may not need such a pointer. | 234 // future directions may not need such a pointer. |
235 external_delegate_ = delegate; | 235 external_delegate_ = delegate; |
236 autocomplete_history_manager_->SetExternalDelegate(delegate); | 236 autocomplete_history_manager_->SetExternalDelegate(delegate); |
237 } | 237 } |
238 | 238 |
239 void AutofillManager::ShowAutofillSettings() { | 239 void AutofillManager::ShowAutofillSettings() { |
240 manager_delegate_->ShowAutofillSettings(); | 240 manager_delegate_->ShowAutofillSettings(); |
241 } | 241 } |
242 | 242 |
| 243 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 244 bool AutofillManager::ShouldShowAccessAddressBookSuggestion( |
| 245 const FormData& form, |
| 246 const FormFieldData& field) { |
| 247 if (!personal_data_) |
| 248 return false; |
| 249 FormStructure* form_structure = NULL; |
| 250 AutofillField* autofill_field = NULL; |
| 251 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) |
| 252 return false; |
| 253 |
| 254 return personal_data_->ShouldShowAccessAddressBookSuggestion( |
| 255 autofill_field->Type()); |
| 256 } |
| 257 |
| 258 bool AutofillManager::AccessAddressBook() { |
| 259 if (!personal_data_) |
| 260 return false; |
| 261 return personal_data_->AccessAddressBook(); |
| 262 } |
| 263 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 264 |
243 bool AutofillManager::OnFormSubmitted(const FormData& form, | 265 bool AutofillManager::OnFormSubmitted(const FormData& form, |
244 const TimeTicks& timestamp) { | 266 const TimeTicks& timestamp) { |
245 if (!IsValidFormData(form)) | 267 if (!IsValidFormData(form)) |
246 return false; | 268 return false; |
247 | 269 |
248 // Let Autocomplete know as well. | 270 // Let Autocomplete know as well. |
249 autocomplete_history_manager_->OnFormSubmitted(form); | 271 autocomplete_history_manager_->OnFormSubmitted(form); |
250 | 272 |
251 // Grab a copy of the form data. | 273 // Grab a copy of the form data. |
252 scoped_ptr<FormStructure> submitted_form(new FormStructure(form)); | 274 scoped_ptr<FormStructure> submitted_form(new FormStructure(form)); |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return false; | 1160 return false; |
1139 | 1161 |
1140 // Disregard forms that we wouldn't ever autofill in the first place. | 1162 // Disregard forms that we wouldn't ever autofill in the first place. |
1141 if (!form.ShouldBeParsed(true)) | 1163 if (!form.ShouldBeParsed(true)) |
1142 return false; | 1164 return false; |
1143 | 1165 |
1144 return true; | 1166 return true; |
1145 } | 1167 } |
1146 | 1168 |
1147 } // namespace autofill | 1169 } // namespace autofill |
OLD | NEW |