| 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 "chrome/browser/password_manager/password_manager.h" | 5 #include "chrome/browser/password_manager/password_manager.h" |
| 6 | 6 |
| 7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/password_manager/password_form_manager.h" | 9 #include "chrome/browser/password_manager/password_form_manager.h" |
| 10 #include "chrome/browser/password_manager/password_manager_delegate.h" | 10 #include "chrome/browser/password_manager/password_manager_delegate.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/autofill_messages.h" | 13 #include "chrome/common/autofill_messages.h" |
| 14 #include "chrome/common/password_generation_util.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "content/public/browser/user_metrics.h" | 16 #include "content/public/browser/user_metrics.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/frame_navigate_params.h" | 18 #include "content/public/common/frame_navigate_params.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 | 20 |
| 20 using content::UserMetricsAction; | 21 using content::UserMetricsAction; |
| 21 using content::WebContents; | 22 using content::WebContents; |
| 22 using webkit::forms::PasswordForm; | 23 using webkit::forms::PasswordForm; |
| 23 using webkit::forms::PasswordFormMap; | 24 using webkit::forms::PasswordFormMap; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 NOTREACHED(); | 233 NOTREACHED(); |
| 233 provisional_save_manager_.reset(); | 234 provisional_save_manager_.reset(); |
| 234 return; | 235 return; |
| 235 } | 236 } |
| 236 | 237 |
| 237 // Looks like a successful login attempt. Either show an infobar or | 238 // Looks like a successful login attempt. Either show an infobar or |
| 238 // automatically save the login data. We prompt when the user hasn't already | 239 // automatically save the login data. We prompt when the user hasn't already |
| 239 // given consent, either through previously accepting the infobar or by having | 240 // given consent, either through previously accepting the infobar or by having |
| 240 // the browser generate the password. | 241 // the browser generate the password. |
| 241 provisional_save_manager_->SubmitPassed(); | 242 provisional_save_manager_->SubmitPassed(); |
| 243 if (provisional_save_manager_->HasGeneratedPassword()) |
| 244 password_generation::LogPasswordGenerationEvents( |
| 245 password_generation::SUBMITTED); |
| 242 if (provisional_save_manager_->IsNewLogin() && | 246 if (provisional_save_manager_->IsNewLogin() && |
| 243 !provisional_save_manager_->HasGeneratedPassword()) { | 247 !provisional_save_manager_->HasGeneratedPassword()) { |
| 244 delegate_->AddSavePasswordInfoBarIfPermitted( | 248 delegate_->AddSavePasswordInfoBarIfPermitted( |
| 245 provisional_save_manager_.release()); | 249 provisional_save_manager_.release()); |
| 246 } else { | 250 } else { |
| 247 provisional_save_manager_->Save(); | 251 provisional_save_manager_->Save(); |
| 248 provisional_save_manager_.reset(); | 252 provisional_save_manager_.reset(); |
| 249 } | 253 } |
| 250 } | 254 } |
| 251 | 255 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 271 if (observer_) { | 275 if (observer_) { |
| 272 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 276 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
| 273 preferred_match.password_value); | 277 preferred_match.password_value); |
| 274 } | 278 } |
| 275 } | 279 } |
| 276 } | 280 } |
| 277 | 281 |
| 278 bool PasswordManager::IsFillingEnabled() const { | 282 bool PasswordManager::IsFillingEnabled() const { |
| 279 return delegate_->GetProfile() && *password_manager_enabled_; | 283 return delegate_->GetProfile() && *password_manager_enabled_; |
| 280 } | 284 } |
| OLD | NEW |