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

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

Issue 256003003: Enable Automatic Passwords Saving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 #include "components/password_manager/core/browser/password_manager.h" 5 #include "components/password_manager/core/browser/password_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // password saving enabled. 263 // password saving enabled.
264 PasswordStore::AuthorizationPromptPolicy prompt_policy = 264 PasswordStore::AuthorizationPromptPolicy prompt_policy =
265 *password_manager_enabled_ ? PasswordStore::ALLOW_PROMPT 265 *password_manager_enabled_ ? PasswordStore::ALLOW_PROMPT
266 : PasswordStore::DISALLOW_PROMPT; 266 : PasswordStore::DISALLOW_PROMPT;
267 267
268 manager->FetchMatchingLoginsFromPasswordStore(prompt_policy); 268 manager->FetchMatchingLoginsFromPasswordStore(prompt_policy);
269 } 269 }
270 } 270 }
271 271
272 bool PasswordManager::ShouldPromptUserToSavePassword() const { 272 bool PasswordManager::ShouldPromptUserToSavePassword() const {
273 return provisional_save_manager_->IsNewLogin() && 273 return !client_->IsAutomaticPasswordSavingEnabled() &&
274 provisional_save_manager_->IsNewLogin() &&
274 !provisional_save_manager_->HasGeneratedPassword() && 275 !provisional_save_manager_->HasGeneratedPassword() &&
275 !provisional_save_manager_->IsPendingCredentialsPublicSuffixMatch(); 276 !provisional_save_manager_->IsPendingCredentialsPublicSuffixMatch();
276 } 277 }
277 278
278 void PasswordManager::OnPasswordFormsRendered( 279 void PasswordManager::OnPasswordFormsRendered(
279 const std::vector<PasswordForm>& visible_forms) { 280 const std::vector<PasswordForm>& visible_forms) {
280 if (!provisional_save_manager_.get()) 281 if (!provisional_save_manager_.get())
281 return; 282 return;
282 283
283 DCHECK(IsSavingEnabled()); 284 DCHECK(IsSavingEnabled());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 observers_, 388 observers_,
388 OnAutofillDataAvailable(preferred_match.username_value, 389 OnAutofillDataAvailable(preferred_match.username_value,
389 preferred_match.password_value)); 390 preferred_match.password_value));
390 break; 391 break;
391 } 392 }
392 393
393 client_->PasswordWasAutofilled(best_matches); 394 client_->PasswordWasAutofilled(best_matches);
394 } 395 }
395 396
396 } // namespace password_manager 397 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698