| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |