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/ui/webui/options2/autofill_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/autofill_options_handler2.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 RegisterStrings(localized_strings, resources, arraysize(resources)); | 295 RegisterStrings(localized_strings, resources, arraysize(resources)); |
296 RegisterTitle(localized_strings, "autofillOptionsPage", | 296 RegisterTitle(localized_strings, "autofillOptionsPage", |
297 IDS_AUTOFILL_OPTIONS_TITLE); | 297 IDS_AUTOFILL_OPTIONS_TITLE); |
298 | 298 |
299 localized_strings->SetString("helpUrl", chrome::kAutofillHelpURL); | 299 localized_strings->SetString("helpUrl", chrome::kAutofillHelpURL); |
300 SetAddressOverlayStrings(localized_strings); | 300 SetAddressOverlayStrings(localized_strings); |
301 SetCreditCardOverlayStrings(localized_strings); | 301 SetCreditCardOverlayStrings(localized_strings); |
302 } | 302 } |
303 | 303 |
304 void AutofillOptionsHandler::Initialize() { | 304 void AutofillOptionsHandler::InitializeHandler() { |
305 personal_data_ = PersonalDataManagerFactory::GetForProfile( | 305 personal_data_ = PersonalDataManagerFactory::GetForProfile( |
306 Profile::FromWebUI(web_ui())); | 306 Profile::FromWebUI(web_ui())); |
307 // personal_data_ is NULL in guest mode on Chrome OS. | 307 // personal_data_ is NULL in guest mode on Chrome OS. |
308 if (personal_data_) { | 308 if (personal_data_) |
309 personal_data_->SetObserver(this); | 309 personal_data_->SetObserver(this); |
| 310 } |
| 311 |
| 312 void AutofillOptionsHandler::InitializePage() { |
| 313 if (personal_data_) |
310 LoadAutofillData(); | 314 LoadAutofillData(); |
311 } | |
312 } | 315 } |
313 | 316 |
314 void AutofillOptionsHandler::RegisterMessages() { | 317 void AutofillOptionsHandler::RegisterMessages() { |
315 web_ui()->RegisterMessageCallback( | 318 web_ui()->RegisterMessageCallback( |
316 "removeAddress", | 319 "removeAddress", |
317 base::Bind(&AutofillOptionsHandler::RemoveAddress, | 320 base::Bind(&AutofillOptionsHandler::RemoveAddress, |
318 base::Unretained(this))); | 321 base::Unretained(this))); |
319 web_ui()->RegisterMessageCallback( | 322 web_ui()->RegisterMessageCallback( |
320 "removeCreditCard", | 323 "removeCreditCard", |
321 base::Bind(&AutofillOptionsHandler::RemoveCreditCard, | 324 base::Bind(&AutofillOptionsHandler::RemoveCreditCard, |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return; | 615 return; |
613 | 616 |
614 ListValue* list_value = NULL; | 617 ListValue* list_value = NULL; |
615 ValidatePhoneArguments(args, &list_value); | 618 ValidatePhoneArguments(args, &list_value); |
616 | 619 |
617 web_ui()->CallJavascriptFunction( | 620 web_ui()->CallJavascriptFunction( |
618 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 621 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
619 } | 622 } |
620 | 623 |
621 } // namespace options2 | 624 } // namespace options2 |
OLD | NEW |