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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_state.cc

Issue 1620083003: Fix best credentials selection algorithm in Password Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests added Created 4 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_state_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/ui/passwords/manage_passwords_state.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" 9 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h"
10 #include "components/password_manager/core/browser/log_manager.h" 10 #include "components/password_manager/core/browser/log_manager.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 origin_ = form_manager_->pending_credentials().origin; 148 origin_ = form_manager_->pending_credentials().origin;
149 SetState(password_manager::ui::CONFIRMATION_STATE); 149 SetState(password_manager::ui::CONFIRMATION_STATE);
150 } 150 }
151 151
152 void ManagePasswordsState::OnPasswordAutofilled( 152 void ManagePasswordsState::OnPasswordAutofilled(
153 const PasswordFormMap& password_form_map, 153 const PasswordFormMap& password_form_map,
154 const GURL& origin) { 154 const GURL& origin) {
155 // TODO(vabr): Revert back to DCHECK once http://crbug.com/486931 is fixed. 155 // TODO(vabr): Revert back to DCHECK once http://crbug.com/486931 is fixed.
156 CHECK(!password_form_map.empty()); 156 CHECK(!password_form_map.empty());
157 ClearData(); 157 ClearData();
158 if (password_form_map.begin()->second->is_public_suffix_match) { 158 bool only_PSL_matches =
159 find_if(password_form_map.begin(), password_form_map.end(),
160 [](const std::pair<const base::string16,
161 scoped_ptr<autofill::PasswordForm>>& p) {
162 return !p.second->is_public_suffix_match;
163 }) == password_form_map.end();
164 if (only_PSL_matches) {
159 // Don't show the UI for PSL matched passwords. They are not stored for this 165 // Don't show the UI for PSL matched passwords. They are not stored for this
160 // page and cannot be deleted. 166 // page and cannot be deleted.
161 origin_ = GURL(); 167 origin_ = GURL();
162 SetState(password_manager::ui::INACTIVE_STATE); 168 SetState(password_manager::ui::INACTIVE_STATE);
163 } else { 169 } else {
164 local_credentials_forms_ = DeepCopyMapToVector(password_form_map); 170 local_credentials_forms_ = DeepCopyMapToVector(password_form_map);
165 origin_ = origin; 171 origin_ = origin;
166 SetState(password_manager::ui::MANAGE_STATE); 172 SetState(password_manager::ui::MANAGE_STATE);
167 } 173 }
168 } 174 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 DCHECK(client_); 306 DCHECK(client_);
301 if (client_->GetLogManager()->IsLoggingActive()) { 307 if (client_->GetLogManager()->IsLoggingActive()) {
302 password_manager::BrowserSavePasswordProgressLogger logger( 308 password_manager::BrowserSavePasswordProgressLogger logger(
303 client_->GetLogManager()); 309 client_->GetLogManager());
304 logger.LogNumber( 310 logger.LogNumber(
305 autofill::SavePasswordProgressLogger::STRING_NEW_UI_STATE, 311 autofill::SavePasswordProgressLogger::STRING_NEW_UI_STATE,
306 state); 312 state);
307 } 313 }
308 state_ = state; 314 state_ = state;
309 } 315 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698