| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 13 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 14 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 15 #include "base/scoped_vector.h" | 16 #include "base/scoped_vector.h" |
| 16 #include "base/string16.h" | 17 #include "base/string16.h" |
| 17 #include "chrome/browser/autofill/autofill_dialog.h" | 18 #include "chrome/browser/autofill/autofill_dialog.h" |
| 18 #include "chrome/browser/autofill/autofill_profile.h" | 19 #include "chrome/browser/autofill/autofill_profile.h" |
| 19 #include "chrome/browser/autofill/credit_card.h" | 20 #include "chrome/browser/autofill/credit_card.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Re-loads profiles and credit cards from the WebDatabase asynchronously. | 153 // Re-loads profiles and credit cards from the WebDatabase asynchronously. |
| 153 // In the general case, this is a no-op and will re-create the same | 154 // In the general case, this is a no-op and will re-create the same |
| 154 // in-memory model as existed prior to the call. If any change occurred to | 155 // in-memory model as existed prior to the call. If any change occurred to |
| 155 // profiles in the WebDatabase directly, as is the case if the browser sync | 156 // profiles in the WebDatabase directly, as is the case if the browser sync |
| 156 // engine processed a change from the cloud, we will learn of these as a | 157 // engine processed a change from the cloud, we will learn of these as a |
| 157 // result of this call. | 158 // result of this call. |
| 158 // | 159 // |
| 159 // Also see SetProfile for more details. | 160 // Also see SetProfile for more details. |
| 160 virtual void Refresh(); | 161 virtual void Refresh(); |
| 161 | 162 |
| 163 // Gets hexadecimal string of a bitmask of the data available in profile with |
| 164 // |profile_guid| guid and credit card with |cc_guid| guid. |
| 165 std::string PresentData(const std::string& profile_guid, |
| 166 const std::string& cc_guid); |
| 167 |
| 162 // Kicks off asynchronous loading of profiles and credit cards. | 168 // Kicks off asynchronous loading of profiles and credit cards. |
| 163 void Init(Profile* profile); | 169 void Init(Profile* profile); |
| 164 | 170 |
| 165 protected: | 171 protected: |
| 166 // Make sure that only Profile and certain tests can create an instance of | 172 // Make sure that only Profile and certain tests can create an instance of |
| 167 // PersonalDataManager. | 173 // PersonalDataManager. |
| 168 friend class base::RefCountedThreadSafe<PersonalDataManager>; | 174 friend class base::RefCountedThreadSafe<PersonalDataManager>; |
| 169 friend class PersonalDataManagerTest; | 175 friend class PersonalDataManagerTest; |
| 170 friend class ProfileImpl; | 176 friend class ProfileImpl; |
| 171 friend class ProfileSyncServiceAutofillTest; | 177 friend class ProfileSyncServiceAutofillTest; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 201 | 207 |
| 202 // Ensures that all profile labels are unique by appending an increasing digit | 208 // Ensures that all profile labels are unique by appending an increasing digit |
| 203 // to the end of non-unique labels. | 209 // to the end of non-unique labels. |
| 204 // TODO(jhawkins): Create a new interface for labeled entities and turn these | 210 // TODO(jhawkins): Create a new interface for labeled entities and turn these |
| 205 // two methods into one. | 211 // two methods into one. |
| 206 void SetUniqueCreditCardLabels(std::vector<CreditCard>* credit_cards); | 212 void SetUniqueCreditCardLabels(std::vector<CreditCard>* credit_cards); |
| 207 | 213 |
| 208 // Saves |imported_profile_| to the WebDB if it exists. | 214 // Saves |imported_profile_| to the WebDB if it exists. |
| 209 void SaveImportedProfile(); | 215 void SaveImportedProfile(); |
| 210 | 216 |
| 217 // Helper for PresentData(): sets present bits in |binary_data_mask| |
| 218 // for the |profile|. |
| 219 void SetDataPresenseBits(FormGroup const* profile, uint8* binary_data_mask); |
| 220 |
| 211 // The profile hosting this PersonalDataManager. | 221 // The profile hosting this PersonalDataManager. |
| 212 Profile* profile_; | 222 Profile* profile_; |
| 213 | 223 |
| 214 // True if personal data has been loaded from the web database. | 224 // True if personal data has been loaded from the web database. |
| 215 bool is_data_loaded_; | 225 bool is_data_loaded_; |
| 216 | 226 |
| 217 // The loaded web profiles. | 227 // The loaded web profiles. |
| 218 ScopedVector<AutoFillProfile> web_profiles_; | 228 ScopedVector<AutoFillProfile> web_profiles_; |
| 219 | 229 |
| 220 // Auxiliary profiles. | 230 // Auxiliary profiles. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 244 WebDataService::Handle pending_profiles_query_; | 254 WebDataService::Handle pending_profiles_query_; |
| 245 WebDataService::Handle pending_creditcards_query_; | 255 WebDataService::Handle pending_creditcards_query_; |
| 246 | 256 |
| 247 // The observers. | 257 // The observers. |
| 248 ObserverList<Observer> observers_; | 258 ObserverList<Observer> observers_; |
| 249 | 259 |
| 250 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 260 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
| 251 }; | 261 }; |
| 252 | 262 |
| 253 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ | 263 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ |
| OLD | NEW |