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

Side by Side Diff: components/password_manager/core/browser/credential_manager_impl.cc

Issue 2716583003: Rename Origin.unique() to opaque().
Patch Set: Update new uses post-rebase Created 3 years, 4 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "components/password_manager/core/browser/credential_manager_impl.h" 4 #include "components/password_manager/core/browser/credential_manager_impl.h"
5 5
6 #include "base/metrics/user_metrics.h" 6 #include "base/metrics/user_metrics.h"
7 #include "components/password_manager/core/browser/credential_manager_logger.h" 7 #include "components/password_manager/core/browser/credential_manager_logger.h"
8 #include "components/password_manager/core/browser/form_fetcher_impl.h" 8 #include "components/password_manager/core/browser/form_fetcher_impl.h"
9 #include "components/password_manager/core/browser/form_saver.h" 9 #include "components/password_manager/core/browser/form_saver.h"
10 #include "components/password_manager/core/browser/password_manager_util.h" 10 #include "components/password_manager/core/browser/password_manager_util.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 pending_request_.reset(); 165 pending_request_.reset();
166 } 166 }
167 167
168 void CredentialManagerImpl::SendPasswordForm( 168 void CredentialManagerImpl::SendPasswordForm(
169 const SendCredentialCallback& send_callback, 169 const SendCredentialCallback& send_callback,
170 CredentialMediationRequirement mediation, 170 CredentialMediationRequirement mediation,
171 const autofill::PasswordForm* form) { 171 const autofill::PasswordForm* form) {
172 CredentialInfo info; 172 CredentialInfo info;
173 if (form) { 173 if (form) {
174 password_manager::CredentialType type_to_return = 174 password_manager::CredentialType type_to_return =
175 form->federation_origin.unique() 175 form->federation_origin.opaque()
176 ? CredentialType::CREDENTIAL_TYPE_PASSWORD 176 ? CredentialType::CREDENTIAL_TYPE_PASSWORD
177 : CredentialType::CREDENTIAL_TYPE_FEDERATED; 177 : CredentialType::CREDENTIAL_TYPE_FEDERATED;
178 info = CredentialInfo(*form, type_to_return); 178 info = CredentialInfo(*form, type_to_return);
179 if (PasswordStore* store = GetPasswordStore()) { 179 if (PasswordStore* store = GetPasswordStore()) {
180 if (form->skip_zero_click && IsZeroClickAllowed()) { 180 if (form->skip_zero_click && IsZeroClickAllowed()) {
181 autofill::PasswordForm update_form = *form; 181 autofill::PasswordForm update_form = *form;
182 update_form.skip_zero_click = false; 182 update_form.skip_zero_click = false;
183 store->UpdateLogin(update_form); 183 store->UpdateLogin(update_form);
184 } 184 }
185 } 185 }
(...skipping 29 matching lines...) Expand all
215 const autofill::PasswordForm& form = form_manager_->pending_credentials(); 215 const autofill::PasswordForm& form = form_manager_->pending_credentials();
216 216
217 if (form_manager_->IsPendingCredentialsPublicSuffixMatch()) { 217 if (form_manager_->IsPendingCredentialsPublicSuffixMatch()) {
218 // Having a credential with a PSL match implies there is no credential with 218 // Having a credential with a PSL match implies there is no credential with
219 // an exactly matching origin and username. In order to avoid showing a save 219 // an exactly matching origin and username. In order to avoid showing a save
220 // bubble to the user Save() is called directly. 220 // bubble to the user Save() is called directly.
221 form_manager_->Save(); 221 form_manager_->Save();
222 return; 222 return;
223 } 223 }
224 224
225 if (!form.federation_origin.unique()) { 225 if (!form.federation_origin.opaque()) {
226 // If this is a federated credential, check it against the federated matches 226 // If this is a federated credential, check it against the federated matches
227 // produced by the PasswordFormManager. If a match is found, update it and 227 // produced by the PasswordFormManager. If a match is found, update it and
228 // return. 228 // return.
229 for (auto* match : form_manager_->form_fetcher()->GetFederatedMatches()) { 229 for (auto* match : form_manager_->form_fetcher()->GetFederatedMatches()) {
230 if (match->username_value == form.username_value && 230 if (match->username_value == form.username_value &&
231 match->federation_origin.IsSameOriginWith(form.federation_origin)) { 231 match->federation_origin.IsSameOriginWith(form.federation_origin)) {
232 form_manager_->Update(*match); 232 form_manager_->Update(*match);
233 return; 233 return;
234 } 234 }
235 } 235 }
236 } else if (!form_manager_->IsNewLogin()) { 236 } else if (!form_manager_->IsNewLogin()) {
237 // Otherwise, if this is not a new password credential, update the existing 237 // Otherwise, if this is not a new password credential, update the existing
238 // credential without prompting the user. This will also update the 238 // credential without prompting the user. This will also update the
239 // 'skip_zero_click' state, as we've gotten an explicit signal that the page 239 // 'skip_zero_click' state, as we've gotten an explicit signal that the page
240 // understands the credential management API and so can be trusted to notify 240 // understands the credential management API and so can be trusted to notify
241 // us when they sign the user out. 241 // us when they sign the user out.
242 form_manager_->Update(*form_manager_->preferred_match()); 242 form_manager_->Update(*form_manager_->preferred_match());
243 return; 243 return;
244 } 244 }
245 245
246 // Otherwise, this is a new form, so as the user if they'd like to save. 246 // Otherwise, this is a new form, so as the user if they'd like to save.
247 client_->PromptUserToSaveOrUpdatePassword(std::move(form_manager_), false); 247 client_->PromptUserToSaveOrUpdatePassword(std::move(form_manager_), false);
248 } 248 }
249 249
250 GURL CredentialManagerImpl::GetLastCommittedURL() const { 250 GURL CredentialManagerImpl::GetLastCommittedURL() const {
251 return client_->GetLastCommittedEntryURL(); 251 return client_->GetLastCommittedEntryURL();
252 } 252 }
253 253
254 } // namespace password_manager 254 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698