| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autofill/personal_data_manager.h" | 5 #include "chrome/browser/autofill/personal_data_manager.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #import <AddressBook/AddressBook.h> | 9 #import <AddressBook/AddressBook.h> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 ScopedVector<AutofillProfile>& profiles_; | 59 ScopedVector<AutofillProfile>& profiles_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfilesImpl); | 61 DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfilesImpl); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // This method uses the |ABAddressBook| system service to fetch the "me" card | 64 // This method uses the |ABAddressBook| system service to fetch the "me" card |
| 65 // from the active user's address book. It looks for the user address | 65 // from the active user's address book. It looks for the user address |
| 66 // information and translates it to the internal list of |AutofillProfile| data | 66 // information and translates it to the internal list of |AutofillProfile| data |
| 67 // structures. | 67 // structures. |
| 68 void AuxiliaryProfilesImpl::GetAddressBookMeCard() { | 68 void AuxiliaryProfilesImpl::GetAddressBookMeCard() { |
| 69 profiles_.reset(); | 69 profiles_.clear(); |
| 70 | 70 |
| 71 ABAddressBook* addressBook = [ABAddressBook sharedAddressBook]; | 71 ABAddressBook* addressBook = [ABAddressBook sharedAddressBook]; |
| 72 ABPerson* me = [addressBook me]; | 72 ABPerson* me = [addressBook me]; |
| 73 if (!me) | 73 if (!me) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 ABMultiValue* addresses = [me valueForProperty:kABAddressProperty]; | 76 ABMultiValue* addresses = [me valueForProperty:kABAddressProperty]; |
| 77 | 77 |
| 78 // The number of characters at the end of the GUID to reserve for | 78 // The number of characters at the end of the GUID to reserve for |
| 79 // distinguishing addresses within the "me" card. Cap the number of addresses | 79 // distinguishing addresses within the "me" card. Cap the number of addresses |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace | 241 } // namespace |
| 242 | 242 |
| 243 // Populate |auxiliary_profiles_| with the Address Book data. | 243 // Populate |auxiliary_profiles_| with the Address Book data. |
| 244 void PersonalDataManager::LoadAuxiliaryProfiles() const { | 244 void PersonalDataManager::LoadAuxiliaryProfiles() const { |
| 245 AuxiliaryProfilesImpl impl(&auxiliary_profiles_); | 245 AuxiliaryProfilesImpl impl(&auxiliary_profiles_); |
| 246 impl.GetAddressBookMeCard(); | 246 impl.GetAddressBookMeCard(); |
| 247 } | 247 } |
| OLD | NEW |