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

Side by Side Diff: components/password_manager/core/browser/password_form_manager.h

Issue 548953002: [Password Manager] Modified to support saving passwords on forms without username fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit-tests and fixed lint errors. Created 6 years, 3 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
OLDNEW
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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Used by PasswordManager to determine whether or not to display 92 // Used by PasswordManager to determine whether or not to display
93 // a SavePasswordBar when given the green light to save the PasswordForm 93 // a SavePasswordBar when given the green light to save the PasswordForm
94 // managed by this. 94 // managed by this.
95 bool IsNewLogin(); 95 bool IsNewLogin();
96 96
97 // Returns true if the current pending credentials were found using 97 // Returns true if the current pending credentials were found using
98 // origin matching of the public suffix, instead of the signon realm of the 98 // origin matching of the public suffix, instead of the signon realm of the
99 // form. 99 // form.
100 bool IsPendingCredentialsPublicSuffixMatch(); 100 bool IsPendingCredentialsPublicSuffixMatch();
101 101
102 // Checks if the form is a valid password form. Forms which lack either 102 // Checks if the form is a valid password form. Forms which lack password
103 // login or password field are not considered valid. 103 // field are not considered valid.
104 bool HasValidPasswordForm(); 104 bool HasValidPasswordForm();
105 105
106 // Checks if the forms do not lack username field.
107 bool HasValidLogin();
108
106 // These functions are used to determine if this form has had it's password 109 // These functions are used to determine if this form has had it's password
107 // auto generated by the browser. 110 // auto generated by the browser.
108 bool HasGeneratedPassword(); 111 bool HasGeneratedPassword();
109 void SetHasGeneratedPassword(); 112 void SetHasGeneratedPassword();
110 113
111 // Determines if we need to autofill given the results of the query. 114 // Determines if we need to autofill given the results of the query.
112 // Takes ownership of the elements in |result|. 115 // Takes ownership of the elements in |result|.
113 void OnRequestDone(const std::vector<autofill::PasswordForm*>& result); 116 void OnRequestDone(const std::vector<autofill::PasswordForm*>& result);
114 117
115 virtual void OnGetPasswordStoreResults( 118 virtual void OnGetPasswordStoreResults(
116 const std::vector<autofill::PasswordForm*>& results) OVERRIDE; 119 const std::vector<autofill::PasswordForm*>& results) OVERRIDE;
117 120
118 // A user opted to 'never remember' passwords for this form. 121 // A user opted to 'never remember' passwords for this form.
119 // Blacklist it so that from now on when it is seen we ignore it. 122 // Blacklist it so that from now on when it is seen we ignore it.
120 // TODO: Make this private once we switch to the new UI. 123 // TODO(vabr): Make this private once we switch to the new UI.
vabr (Chromium) 2014/09/15 13:01:45 Why do you change this comment (and the one below)
Pritam Nikam 2014/09/15 15:02:08 Done. I've changed this to resolve Lint error. No
121 void PermanentlyBlacklist(); 124 void PermanentlyBlacklist();
122 125
123 // Sets whether the password form should use additional password 126 // Sets whether the password form should use additional password
124 // authentication if available before being used for autofill. 127 // authentication if available before being used for autofill.
125 void SetUseAdditionalPasswordAuthentication( 128 void SetUseAdditionalPasswordAuthentication(
126 bool use_additional_authentication); 129 bool use_additional_authentication);
127 130
128 // If the user has submitted observed_form_, provisionally hold on to 131 // If the user has submitted observed_form_, provisionally hold on to
129 // the submitted credentials until we are told by PasswordManager whether 132 // the submitted credentials until we are told by PasswordManager whether
130 // or not the login was successful. |action| describes how we deal with 133 // or not the login was successful. |action| describes how we deal with
131 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will 134 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will
132 // treat a possible usernames match as a sign that our original heuristics 135 // treat a possible usernames match as a sign that our original heuristics
133 // were wrong and that the user selected the correct username from the 136 // were wrong and that the user selected the correct username from the
134 // Autofill UI. 137 // Autofill UI.
135 void ProvisionallySave(const autofill::PasswordForm& credentials, 138 void ProvisionallySave(const autofill::PasswordForm& credentials,
136 OtherPossibleUsernamesAction action); 139 OtherPossibleUsernamesAction action);
137 140
138 // Handles save-as-new or update of the form managed by this manager. 141 // Handles save-as-new or update of the form managed by this manager.
139 // Note the basic data of updated_credentials must match that of 142 // Note the basic data of updated_credentials must match that of
140 // observed_form_ (e.g DoesManage(pending_credentials_) == true). 143 // observed_form_ (e.g DoesManage(pending_credentials_) == true).
141 // TODO: Make this private once we switch to the new UI. 144 // TODO(vabr): Make this private once we switch to the new UI.
142 void Save(); 145 void Save();
143 146
144 // Call these if/when we know the form submission worked or failed. 147 // Call these if/when we know the form submission worked or failed.
145 // These routines are used to update internal statistics ("ActionsTaken"). 148 // These routines are used to update internal statistics ("ActionsTaken").
146 void SubmitPassed(); 149 void SubmitPassed();
147 void SubmitFailed(); 150 void SubmitFailed();
148 151
149 // Returns the username associated with the credentials. 152 // Returns the username associated with the credentials.
150 const base::string16& associated_username() const { 153 const base::string16& associated_username() const {
151 return pending_credentials_.username_value; 154 return pending_credentials_.username_value;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 ManagerAction manager_action_; 331 ManagerAction manager_action_;
329 UserAction user_action_; 332 UserAction user_action_;
330 SubmitResult submit_result_; 333 SubmitResult submit_result_;
331 334
332 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); 335 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager);
333 }; 336 };
334 337
335 } // namespace password_manager 338 } // namespace password_manager
336 339
337 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 340 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698