Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/autofill/personal_data_manager.h

Issue 1902003: Revert 46424 - AutoFill profile shouldn't be saved when cancelled during init... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // WebDataServiceConsumer implementation: 44 // WebDataServiceConsumer implementation:
45 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, 45 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
46 const WDTypedResult* result); 46 const WDTypedResult* result);
47 47
48 // AutoFillDialogObserver implementation: 48 // AutoFillDialogObserver implementation:
49 virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles, 49 virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles,
50 std::vector<CreditCard>* credit_cards); 50 std::vector<CreditCard>* credit_cards);
51 51
52 // Sets the listener to be notified of PersonalDataManager events. 52 // Sets the listener to be notified of PersonalDataManager events.
53 virtual void SetObserver(PersonalDataManager::Observer* observer); 53 void SetObserver(PersonalDataManager::Observer* observer);
54 54
55 // Removes |observer| as the observer of this PersonalDataManager. 55 // Removes |observer| as the observer of this PersonalDataManager.
56 virtual void RemoveObserver(PersonalDataManager::Observer* observer); 56 void RemoveObserver(PersonalDataManager::Observer* observer);
57 57
58 // If AutoFill is able to determine the field types of a significant number 58 // If AutoFill is able to determine the field types of a significant number
59 // of field types that contain information in the FormStructures and the user 59 // of field types that contain information in the FormStructures and the user
60 // has not previously been prompted, the user will be asked if he would like 60 // has not previously been prompted, the user will be asked if he would like
61 // to import the data. If the user selects yes, a profile will be created 61 // to import the data. If the user selects yes, a profile will be created
62 // with all of the information from recognized fields. 62 // with all of the information from recognized fields.
63 bool ImportFormData(const std::vector<FormStructure*>& form_structures, 63 bool ImportFormData(const std::vector<FormStructure*>& form_structures,
64 AutoFillManager* autofill_manager); 64 AutoFillManager* autofill_manager);
65 65
66 // Saves |imported_profile_| and |imported_credit_card_| to the WebDB if they 66 // Saves |imported_profile_| and |imported_credit_card_| to the WebDB if they
67 // exist. 67 // exist.
68 void SaveImportedFormData(); 68 void SaveImportedFormData();
69 69
70 // Gets |imported_profile_| and |imported_credit_card_| and returns their
71 // values in |profile| and |credit_card| parameters respectively. One or
72 // both may return NULL. The objects returned are owned by the
73 // PersonalDataManager, so should be considered weak references by caller.
74 // TODO(dhollowa) Now that we aren't immediately saving the imported form
75 // data, we should store the profile and CC in the AFM instead of the PDM.
76 void GetImportedFormData(AutoFillProfile** profile, CreditCard** credit_card);
77
78 // Sets |web_profiles_| to the contents of |profiles| and updates the web 70 // Sets |web_profiles_| to the contents of |profiles| and updates the web
79 // database by adding, updating and removing profiles. Sets the unique ID of 71 // database by adding, updating and removing profiles. Sets the unique ID of
80 // newly-added profiles. 72 // newly-added profiles.
81 // 73 //
82 // The relationship between this and Refresh is subtle. 74 // The relationship between this and Refresh is subtle.
83 // A call to SetProfile could include out-of-date data that may conflict 75 // A call to SetProfile could include out-of-date data that may conflict
84 // if we didn't refresh-to-latest before an autofill window was opened for 76 // if we didn't refresh-to-latest before an autofill window was opened for
85 // editing. SetProfile is implemented to make a "best effort" to apply the 77 // editing. SetProfile is implemented to make a "best effort" to apply the
86 // changes, but in extremely rare edge cases it is possible not all of the 78 // changes, but in extremely rare edge cases it is possible not all of the
87 // updates in |profiles| make it to the DB. This is why SetProfiles will 79 // updates in |profiles| make it to the DB. This is why SetProfiles will
(...skipping 15 matching lines...) Expand all
103 bool HasPassword(); 95 bool HasPassword();
104 96
105 // Returns whether the personal data has been loaded from the web database. 97 // Returns whether the personal data has been loaded from the web database.
106 virtual bool IsDataLoaded() const { return is_data_loaded_; } 98 virtual bool IsDataLoaded() const { return is_data_loaded_; }
107 99
108 // This PersonalDataManager owns these profiles and credit cards. Their 100 // This PersonalDataManager owns these profiles and credit cards. Their
109 // lifetime is until the web database is updated with new profile and credit 101 // lifetime is until the web database is updated with new profile and credit
110 // card information, respectively. |profiles()| returns both web and 102 // card information, respectively. |profiles()| returns both web and
111 // auxiliary profiles. |web_profiles()| returns only web profiles. 103 // auxiliary profiles. |web_profiles()| returns only web profiles.
112 const std::vector<AutoFillProfile*>& profiles(); 104 const std::vector<AutoFillProfile*>& profiles();
113 virtual const std::vector<AutoFillProfile*>& web_profiles(); 105 const std::vector<AutoFillProfile*>& web_profiles();
114 virtual const std::vector<CreditCard*>& credit_cards() { 106 const std::vector<CreditCard*>& credit_cards() { return credit_cards_.get(); }
115 return credit_cards_.get();
116 }
117 107
118 // Returns the index of the default profile within the vector returned by 108 // Returns the index of the default profile within the vector returned by
119 // |web_profiles()|, or -1 if there are no profiles. 109 // |web_profiles()|, or -1 if there are no profiles.
120 int DefaultProfile() const; 110 int DefaultProfile() const;
121 111
122 // Returns the index of the default credit card within the vector returned by 112 // Returns the index of the default credit card within the vector returned by
123 // |credit_cards()|, or -1 if there are no credit cards. 113 // |credit_cards()|, or -1 if there are no credit cards.
124 int DefaultCreditCard() const; 114 int DefaultCreditCard() const;
125 115
126 // Creates a profile labeled |label|, with it's own locally unique ID. 116 // Creates a profile labeled |label|, with it's own locally unique ID.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 WebDataService::Handle pending_profiles_query_; 241 WebDataService::Handle pending_profiles_query_;
252 WebDataService::Handle pending_creditcards_query_; 242 WebDataService::Handle pending_creditcards_query_;
253 243
254 // The observers. This can be empty. 244 // The observers. This can be empty.
255 std::vector<PersonalDataManager::Observer*> observers_; 245 std::vector<PersonalDataManager::Observer*> observers_;
256 246
257 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); 247 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager);
258 }; 248 };
259 249
260 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_ 250 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698