| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::InitializeHandler() { | 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. | |
| 308 if (personal_data_) | |
| 309 personal_data_->SetObserver(this); | |
| 310 } | 307 } |
| 311 | 308 |
| 312 void AutofillOptionsHandler::InitializePage() { | 309 void AutofillOptionsHandler::InitializePage() { |
| 313 if (personal_data_) | 310 // personal_data_ is NULL in guest mode on Chrome OS. |
| 311 if (personal_data_) { |
| 312 personal_data_->SetObserver(this); |
| 314 LoadAutofillData(); | 313 LoadAutofillData(); |
| 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 void AutofillOptionsHandler::RegisterMessages() { | 317 void AutofillOptionsHandler::RegisterMessages() { |
| 318 web_ui()->RegisterMessageCallback( | 318 web_ui()->RegisterMessageCallback( |
| 319 "removeAddress", | 319 "removeAddress", |
| 320 base::Bind(&AutofillOptionsHandler::RemoveAddress, | 320 base::Bind(&AutofillOptionsHandler::RemoveAddress, |
| 321 base::Unretained(this))); | 321 base::Unretained(this))); |
| 322 web_ui()->RegisterMessageCallback( | 322 web_ui()->RegisterMessageCallback( |
| 323 "removeCreditCard", | 323 "removeCreditCard", |
| 324 base::Bind(&AutofillOptionsHandler::RemoveCreditCard, | 324 base::Bind(&AutofillOptionsHandler::RemoveCreditCard, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 return; | 615 return; |
| 616 | 616 |
| 617 ListValue* list_value = NULL; | 617 ListValue* list_value = NULL; |
| 618 ValidatePhoneArguments(args, &list_value); | 618 ValidatePhoneArguments(args, &list_value); |
| 619 | 619 |
| 620 web_ui()->CallJavascriptFunction( | 620 web_ui()->CallJavascriptFunction( |
| 621 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 621 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
| 622 } | 622 } |
| 623 | 623 |
| 624 } // namespace options2 | 624 } // namespace options2 |
| OLD | NEW |