OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/autofill/autofill_dialog.h" | 10 #include "chrome/browser/autofill/autofill_dialog.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // static | 36 // static |
37 void AutoFillManager::RegisterBrowserPrefs(PrefService* prefs) { | 37 void AutoFillManager::RegisterBrowserPrefs(PrefService* prefs) { |
38 prefs->RegisterDictionaryPref(prefs::kAutoFillDialogPlacement); | 38 prefs->RegisterDictionaryPref(prefs::kAutoFillDialogPlacement); |
39 } | 39 } |
40 | 40 |
41 // static | 41 // static |
42 void AutoFillManager::RegisterUserPrefs(PrefService* prefs) { | 42 void AutoFillManager::RegisterUserPrefs(PrefService* prefs) { |
43 prefs->RegisterBooleanPref(prefs::kAutoFillInfoBarShown, false); | 43 prefs->RegisterBooleanPref(prefs::kAutoFillInfoBarShown, false); |
44 prefs->RegisterBooleanPref(prefs::kAutoFillEnabled, true); | 44 prefs->RegisterBooleanPref(prefs::kAutoFillEnabled, true); |
| 45 prefs->RegisterBooleanPref(prefs::kAutoFillAuxiliaryProfilesEnabled, false); |
45 } | 46 } |
46 | 47 |
47 void AutoFillManager::FormFieldValuesSubmitted( | 48 void AutoFillManager::FormFieldValuesSubmitted( |
48 const webkit_glue::FormFieldValues& form) { | 49 const webkit_glue::FormFieldValues& form) { |
49 if (!personal_data_) | 50 if (!personal_data_) |
50 return; | 51 return; |
51 | 52 |
52 // Grab a copy of the form data. | 53 // Grab a copy of the form data. |
53 upload_form_structure_.reset(new FormStructure(form)); | 54 upload_form_structure_.reset(new FormStructure(form)); |
54 | 55 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 224 } |
224 | 225 |
225 void AutoFillManager::OnPersonalDataLoaded() { | 226 void AutoFillManager::OnPersonalDataLoaded() { |
226 DCHECK(personal_data_); | 227 DCHECK(personal_data_); |
227 | 228 |
228 // We might have been alerted that the PersonalDataManager has loaded, so | 229 // We might have been alerted that the PersonalDataManager has loaded, so |
229 // remove ourselves as observer. | 230 // remove ourselves as observer. |
230 personal_data_->RemoveObserver(this); | 231 personal_data_->RemoveObserver(this); |
231 | 232 |
232 ShowAutoFillDialog( | 233 ShowAutoFillDialog( |
233 this, personal_data_->profiles(), personal_data_->credit_cards()); | 234 this, |
| 235 personal_data_->profiles(), |
| 236 personal_data_->credit_cards(), |
| 237 tab_contents_->profile()->GetOriginalProfile()); |
234 } | 238 } |
235 | 239 |
236 void AutoFillManager::OnInfoBarAccepted() { | 240 void AutoFillManager::OnInfoBarAccepted() { |
237 DCHECK(personal_data_); | 241 DCHECK(personal_data_); |
238 | 242 |
239 PrefService* prefs = tab_contents_->profile()->GetPrefs(); | 243 PrefService* prefs = tab_contents_->profile()->GetPrefs(); |
240 prefs->SetBoolean(prefs::kAutoFillEnabled, true); | 244 prefs->SetBoolean(prefs::kAutoFillEnabled, true); |
241 | 245 |
242 // If the personal data manager has not loaded the data yet, set ourselves as | 246 // If the personal data manager has not loaded the data yet, set ourselves as |
243 // its observer so that we can listen for the OnPersonalDataLoaded signal. | 247 // its observer so that we can listen for the OnPersonalDataLoaded signal. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Migrate obsolete autofill pref. | 300 // Migrate obsolete autofill pref. |
297 if (prefs->HasPrefPath(prefs::kFormAutofillEnabled)) { | 301 if (prefs->HasPrefPath(prefs::kFormAutofillEnabled)) { |
298 bool enabled = prefs->GetBoolean(prefs::kFormAutofillEnabled); | 302 bool enabled = prefs->GetBoolean(prefs::kFormAutofillEnabled); |
299 prefs->ClearPref(prefs::kFormAutofillEnabled); | 303 prefs->ClearPref(prefs::kFormAutofillEnabled); |
300 prefs->SetBoolean(prefs::kAutoFillEnabled, enabled); | 304 prefs->SetBoolean(prefs::kAutoFillEnabled, enabled); |
301 return enabled; | 305 return enabled; |
302 } | 306 } |
303 | 307 |
304 return prefs->GetBoolean(prefs::kAutoFillEnabled); | 308 return prefs->GetBoolean(prefs::kAutoFillEnabled); |
305 } | 309 } |
OLD | NEW |