OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/password_manager/password_form_manager.h" | 12 #include "chrome/browser/password_manager/password_form_manager.h" |
13 #include "chrome/browser/password_manager/password_manager_delegate.h" | 13 #include "chrome/browser/password_manager/password_manager_delegate.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/common/autofill_messages.h" | 16 #include "chrome/common/autofill_messages.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
19 #include "content/public/common/frame_navigate_params.h" | 19 #include "content/public/common/frame_navigate_params.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 | 21 |
22 using content::UserMetricsAction; | 22 using content::UserMetricsAction; |
23 using webkit_glue::PasswordForm; | 23 using webkit::forms::PasswordForm; |
24 using webkit_glue::PasswordFormMap; | 24 using webkit::forms::PasswordFormMap; |
25 | 25 |
26 // static | 26 // static |
27 void PasswordManager::RegisterUserPrefs(PrefService* prefs) { | 27 void PasswordManager::RegisterUserPrefs(PrefService* prefs) { |
28 prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, | 28 prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, |
29 true, | 29 true, |
30 PrefService::SYNCABLE_PREF); | 30 PrefService::SYNCABLE_PREF); |
31 prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, | 31 prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, |
32 true, | 32 true, |
33 PrefService::UNSYNCABLE_PREF); | 33 PrefService::UNSYNCABLE_PREF); |
34 } | 34 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void PasswordManager::Autofill( | 219 void PasswordManager::Autofill( |
220 const PasswordForm& form_for_autofill, | 220 const PasswordForm& form_for_autofill, |
221 const PasswordFormMap& best_matches, | 221 const PasswordFormMap& best_matches, |
222 const PasswordForm* const preferred_match, | 222 const PasswordForm* const preferred_match, |
223 bool wait_for_username) const { | 223 bool wait_for_username) const { |
224 DCHECK(preferred_match); | 224 DCHECK(preferred_match); |
225 switch (form_for_autofill.scheme) { | 225 switch (form_for_autofill.scheme) { |
226 case PasswordForm::SCHEME_HTML: { | 226 case PasswordForm::SCHEME_HTML: { |
227 // Note the check above is required because the observer_ for a non-HTML | 227 // Note the check above is required because the observer_ for a non-HTML |
228 // schemed password form may have been freed, so we need to distinguish. | 228 // schemed password form may have been freed, so we need to distinguish. |
229 webkit_glue::PasswordFormFillData fill_data; | 229 webkit::forms::PasswordFormFillData fill_data; |
230 webkit_glue::PasswordFormDomManager::InitFillData(form_for_autofill, | 230 webkit::forms::PasswordFormDomManager::InitFillData(form_for_autofill, |
231 best_matches, | 231 best_matches, |
232 preferred_match, | 232 preferred_match, |
233 wait_for_username, | 233 wait_for_username, |
234 &fill_data); | 234 &fill_data); |
235 delegate_->FillPasswordForm(fill_data); | 235 delegate_->FillPasswordForm(fill_data); |
236 return; | 236 return; |
237 } | 237 } |
238 default: | 238 default: |
239 if (observer_) { | 239 if (observer_) { |
240 observer_->OnAutofillDataAvailable(preferred_match->username_value, | 240 observer_->OnAutofillDataAvailable(preferred_match->username_value, |
241 preferred_match->password_value); | 241 preferred_match->password_value); |
242 } | 242 } |
243 } | 243 } |
244 } | 244 } |
OLD | NEW |