| 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 #ifndef CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 24 | 24 |
| 25 class AutofillMetrics; | 25 class AutofillMetrics; |
| 26 class FormStructure; | 26 class FormStructure; |
| 27 class PersonalDataManagerObserver; | 27 class PersonalDataManagerObserver; |
| 28 class Profile; | 28 class Profile; |
| 29 | 29 |
| 30 namespace autofill_helper { | 30 namespace autofill_helper { |
| 31 void SetProfiles(int, std::vector<AutofillProfile>*); | 31 void SetProfiles(int, std::vector<AutofillProfile>*); |
| 32 void SetCreditCards(int, std::vector<CreditCard>*); |
| 32 } | 33 } |
| 33 | 34 |
| 34 // Handles loading and saving Autofill profile information to the web database. | 35 // Handles loading and saving Autofill profile information to the web database. |
| 35 // This class also stores the profiles loaded from the database for use during | 36 // This class also stores the profiles loaded from the database for use during |
| 36 // Autofill. | 37 // Autofill. |
| 37 class PersonalDataManager | 38 class PersonalDataManager |
| 38 : public WebDataServiceConsumer, | 39 : public WebDataServiceConsumer, |
| 39 public ProfileSyncServiceObserver, | 40 public ProfileSyncServiceObserver, |
| 40 public ProfileKeyedService, | 41 public ProfileKeyedService, |
| 41 public content::NotificationObserver { | 42 public content::NotificationObserver { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 const std::vector<AutofillProfile*>& existing_profiles, | 142 const std::vector<AutofillProfile*>& existing_profiles, |
| 142 std::vector<AutofillProfile>* merged_profiles); | 143 std::vector<AutofillProfile>* merged_profiles); |
| 143 | 144 |
| 144 protected: | 145 protected: |
| 145 // Only PersonalDataManagerFactory and certain tests can create instances of | 146 // Only PersonalDataManagerFactory and certain tests can create instances of |
| 146 // PersonalDataManager. | 147 // PersonalDataManager. |
| 147 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); | 148 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); |
| 148 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); | 149 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); |
| 149 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, | 150 FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
| 150 AggregateExistingAuxiliaryProfile); | 151 AggregateExistingAuxiliaryProfile); |
| 152 friend class AutofillTest; |
| 151 friend class PersonalDataManagerFactory; | 153 friend class PersonalDataManagerFactory; |
| 152 friend class PersonalDataManagerTest; | 154 friend class PersonalDataManagerTest; |
| 153 friend class scoped_ptr<PersonalDataManager>; | 155 friend class scoped_ptr<PersonalDataManager>; |
| 154 friend class ProfileSyncServiceAutofillTest; | 156 friend class ProfileSyncServiceAutofillTest; |
| 155 friend class TestingAutomationProvider; | 157 friend class TestingAutomationProvider; |
| 156 friend void autofill_helper::SetProfiles(int, std::vector<AutofillProfile>*); | 158 friend void autofill_helper::SetProfiles(int, std::vector<AutofillProfile>*); |
| 159 friend void autofill_helper::SetCreditCards(int, std::vector<CreditCard>*); |
| 157 | 160 |
| 158 PersonalDataManager(); | 161 PersonalDataManager(); |
| 159 virtual ~PersonalDataManager(); | 162 virtual ~PersonalDataManager(); |
| 160 | 163 |
| 161 // Sets |web_profiles_| to the contents of |profiles| and updates the web | 164 // Sets |web_profiles_| to the contents of |profiles| and updates the web |
| 162 // database by adding, updating and removing profiles. | 165 // database by adding, updating and removing profiles. |
| 163 // The relationship between this and Refresh is subtle. | 166 // The relationship between this and Refresh is subtle. |
| 164 // A call to |SetProfiles| could include out-of-date data that may conflict | 167 // A call to |SetProfiles| could include out-of-date data that may conflict |
| 165 // if we didn't refresh-to-latest before an Autofill window was opened for | 168 // if we didn't refresh-to-latest before an Autofill window was opened for |
| 166 // editing. |SetProfiles| is implemented to make a "best effort" to apply the | 169 // editing. |SetProfiles| is implemented to make a "best effort" to apply the |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // Whether we have already logged the number of profiles this session. | 256 // Whether we have already logged the number of profiles this session. |
| 254 mutable bool has_logged_profile_count_; | 257 mutable bool has_logged_profile_count_; |
| 255 | 258 |
| 256 // Manages registration lifetime for NotificationObserver implementation. | 259 // Manages registration lifetime for NotificationObserver implementation. |
| 257 content::NotificationRegistrar notification_registrar_; | 260 content::NotificationRegistrar notification_registrar_; |
| 258 | 261 |
| 259 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 262 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 260 }; | 263 }; |
| 261 | 264 |
| 262 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 265 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |