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" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 } | 86 } |
87 // If there is no corresponding PasswordFormManager, we create one. This is | 87 // If there is no corresponding PasswordFormManager, we create one. This is |
88 // not the common case, and should only happen when there is a bug in our | 88 // not the common case, and should only happen when there is a bug in our |
89 // ability to detect forms. | 89 // ability to detect forms. |
90 bool ssl_valid = (form.origin.SchemeIsSecure() && | 90 bool ssl_valid = (form.origin.SchemeIsSecure() && |
91 !delegate_->DidLastPageLoadEncounterSSLErrors()); | 91 !delegate_->DidLastPageLoadEncounterSSLErrors()); |
92 PasswordFormManager* manager = | 92 PasswordFormManager* manager = |
93 new PasswordFormManager(delegate_->GetProfile(), | 93 new PasswordFormManager(delegate_->GetProfile(), |
94 this, | 94 this, |
95 web_contents()->GetRenderViewHost(), | 95 web_contents(), |
96 form, | 96 form, |
97 ssl_valid); | 97 ssl_valid); |
98 pending_login_managers_.push_back(manager); | 98 pending_login_managers_.push_back(manager); |
99 manager->SetHasGeneratedPassword(); | 99 manager->SetHasGeneratedPassword(); |
100 // TODO(gcasto): Add UMA stats to track this. | 100 // TODO(gcasto): Add UMA stats to track this. |
101 } | 101 } |
102 | 102 |
103 bool PasswordManager::IsSavingEnabled() const { | 103 bool PasswordManager::IsSavingEnabled() const { |
104 return IsFillingEnabled() && !delegate_->GetProfile()->IsOffTheRecord(); | 104 return IsFillingEnabled() && !delegate_->GetProfile()->IsOffTheRecord(); |
105 } | 105 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 // Ask the SSLManager for current security. | 194 // Ask the SSLManager for current security. |
195 bool had_ssl_error = delegate_->DidLastPageLoadEncounterSSLErrors(); | 195 bool had_ssl_error = delegate_->DidLastPageLoadEncounterSSLErrors(); |
196 | 196 |
197 for (std::vector<PasswordForm>::const_iterator iter = forms.begin(); | 197 for (std::vector<PasswordForm>::const_iterator iter = forms.begin(); |
198 iter != forms.end(); ++iter) { | 198 iter != forms.end(); ++iter) { |
199 bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error; | 199 bool ssl_valid = iter->origin.SchemeIsSecure() && !had_ssl_error; |
200 PasswordFormManager* manager = | 200 PasswordFormManager* manager = |
201 new PasswordFormManager(delegate_->GetProfile(), | 201 new PasswordFormManager(delegate_->GetProfile(), |
202 this, | 202 this, |
203 web_contents()->GetRenderViewHost(), | 203 web_contents(), |
204 *iter, | 204 *iter, |
205 ssl_valid); | 205 ssl_valid); |
206 pending_login_managers_.push_back(manager); | 206 pending_login_managers_.push_back(manager); |
207 manager->FetchMatchingLoginsFromPasswordStore(); | 207 manager->FetchMatchingLoginsFromPasswordStore(); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 void PasswordManager::OnPasswordFormsRendered( | 211 void PasswordManager::OnPasswordFormsRendered( |
212 const std::vector<PasswordForm>& visible_forms) { | 212 const std::vector<PasswordForm>& visible_forms) { |
213 if (!provisional_save_manager_.get()) | 213 if (!provisional_save_manager_.get()) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 if (observer_) { | 271 if (observer_) { |
272 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 272 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
273 preferred_match.password_value); | 273 preferred_match.password_value); |
274 } | 274 } |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 bool PasswordManager::IsFillingEnabled() const { | 278 bool PasswordManager::IsFillingEnabled() const { |
279 return delegate_->GetProfile() && *password_manager_enabled_; | 279 return delegate_->GetProfile() && *password_manager_enabled_; |
280 } | 280 } |
OLD | NEW |