OLD | NEW |
---|---|
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_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 DCHECK(client_->IsSavingEnabledForCurrentPage()); | 149 DCHECK(client_->IsSavingEnabledForCurrentPage()); |
150 | 150 |
151 for (ScopedVector<PasswordFormManager>::iterator iter = | 151 for (ScopedVector<PasswordFormManager>::iterator iter = |
152 pending_login_managers_.begin(); | 152 pending_login_managers_.begin(); |
153 iter != pending_login_managers_.end(); ++iter) { | 153 iter != pending_login_managers_.end(); ++iter) { |
154 if ((*iter)->DoesManage(form) == | 154 if ((*iter)->DoesManage(form) == |
155 PasswordFormManager::RESULT_COMPLETE_MATCH) { | 155 PasswordFormManager::RESULT_COMPLETE_MATCH) { |
156 (*iter)->set_has_generated_password(password_is_generated); | 156 (*iter)->set_has_generated_password(password_is_generated); |
157 return; | 157 return; |
158 } | 158 } |
159 } | 159 } |
Garrett Casto
2015/06/22 23:23:57
For completeness, this loop here should actually b
Deepak
2015/06/23 06:23:16
Done.
| |
160 | 160 |
161 if (!password_is_generated) { | 161 if (!password_is_generated) { |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 // If there is no corresponding PasswordFormManager, we create one. This is | 165 // If there is no corresponding PasswordFormManager, we create one. This is |
166 // not the common case, and should only happen when there is a bug in our | 166 // not the common case, and should only happen when there is a bug in our |
167 // ability to detect forms. | 167 // ability to detect forms. |
168 bool ssl_valid = form.origin.SchemeIsCryptographic(); | 168 bool ssl_valid = form.origin.SchemeIsCryptographic(); |
169 PasswordFormManager* manager = new PasswordFormManager( | 169 PasswordFormManager* manager = new PasswordFormManager( |
170 this, client_, driver->AsWeakPtr(), form, ssl_valid); | 170 this, client_, driver->AsWeakPtr(), form, ssl_valid); |
171 pending_login_managers_.push_back(manager); | 171 pending_login_managers_.push_back(manager); |
172 manager->set_has_generated_password(true); | 172 manager->set_has_generated_password(true); |
173 // TODO(gcasto): Add UMA stats to track this. | 173 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SetGeneratedPasswordForForm", |
Garrett Casto
2015/06/22 23:23:57
The name should be something like "PasswordManager
Deepak
2015/06/23 06:23:16
Done.
| |
174 password_is_generated); | |
174 } | 175 } |
175 | 176 |
176 void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { | 177 void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
177 bool is_saving_enabled = client_->IsSavingEnabledForCurrentPage(); | 178 bool is_saving_enabled = client_->IsSavingEnabledForCurrentPage(); |
178 | 179 |
179 scoped_ptr<BrowserSavePasswordProgressLogger> logger; | 180 scoped_ptr<BrowserSavePasswordProgressLogger> logger; |
180 if (client_->IsLoggingActive()) { | 181 if (client_->IsLoggingActive()) { |
181 logger.reset(new BrowserSavePasswordProgressLogger(client_)); | 182 logger.reset(new BrowserSavePasswordProgressLogger(client_)); |
182 logger->LogMessage(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_METHOD); | 183 logger->LogMessage(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_METHOD); |
183 logger->LogPasswordForm(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_FORM, | 184 logger->LogPasswordForm(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_FORM, |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
704 if (ServerTypeToPrediction((*field)->server_type(), &prediction_type)) | 705 if (ServerTypeToPrediction((*field)->server_type(), &prediction_type)) |
705 predictions[form->ToFormData()][prediction_type] = *(*field); | 706 predictions[form->ToFormData()][prediction_type] = *(*field); |
706 } | 707 } |
707 } | 708 } |
708 if (predictions.empty()) | 709 if (predictions.empty()) |
709 return; | 710 return; |
710 driver->AutofillDataReceived(predictions); | 711 driver->AutofillDataReceived(predictions); |
711 } | 712 } |
712 | 713 |
713 } // namespace password_manager | 714 } // namespace password_manager |
OLD | NEW |