OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/password_manager_presenter.h" | 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return; | 125 return; |
126 } | 126 } |
127 if (IsAuthenticationRequired()) { | 127 if (IsAuthenticationRequired()) { |
128 if (password_manager_util::AuthenticateUser( | 128 if (password_manager_util::AuthenticateUser( |
129 password_view_->GetNativeWindow())) | 129 password_view_->GetNativeWindow())) |
130 last_authentication_time_ = base::TimeTicks::Now(); | 130 last_authentication_time_ = base::TimeTicks::Now(); |
131 else | 131 else |
132 return; | 132 return; |
133 } | 133 } |
134 | 134 |
| 135 #if defined(PASSWORD_MANAGER_ENABLE_SYNC) |
135 if (password_manager_sync_metrics::IsSyncAccountCredential( | 136 if (password_manager_sync_metrics::IsSyncAccountCredential( |
136 password_view_->GetProfile(), | 137 password_view_->GetProfile(), |
137 base::UTF16ToUTF8(password_list_[index]->username_value), | 138 base::UTF16ToUTF8(password_list_[index]->username_value), |
138 password_list_[index]->signon_realm)) { | 139 password_list_[index]->signon_realm)) { |
139 content::RecordAction( | 140 content::RecordAction( |
140 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); | 141 base::UserMetricsAction("PasswordManager_SyncCredentialShown")); |
141 } | 142 } |
| 143 #endif |
142 | 144 |
143 // Call back the front end to reveal the password. | 145 // Call back the front end to reveal the password. |
144 password_view_->ShowPassword(index, password_list_[index]->password_value); | 146 password_view_->ShowPassword(index, password_list_[index]->password_value); |
145 #endif | 147 #endif |
146 } | 148 } |
147 | 149 |
148 const autofill::PasswordForm* PasswordManagerPresenter::GetPassword( | 150 const autofill::PasswordForm* PasswordManagerPresenter::GetPassword( |
149 size_t index) { | 151 size_t index) { |
150 if (index >= password_list_.size()) { | 152 if (index >= password_list_.size()) { |
151 // |index| out of bounds might come from a compromised renderer, don't let | 153 // |index| out of bounds might come from a compromised renderer, don't let |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } else { | 232 } else { |
231 LOG(ERROR) << "No password store! Cannot display exceptions."; | 233 LOG(ERROR) << "No password store! Cannot display exceptions."; |
232 } | 234 } |
233 } | 235 } |
234 | 236 |
235 void PasswordManagerPresenter::PasswordExceptionListPopulater:: | 237 void PasswordManagerPresenter::PasswordExceptionListPopulater:: |
236 OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) { | 238 OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) { |
237 page_->password_exception_list_.swap(results); | 239 page_->password_exception_list_.swap(results); |
238 page_->SetPasswordExceptionList(); | 240 page_->SetPasswordExceptionList(); |
239 } | 241 } |
OLD | NEW |