| 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/dom_ui/options/autofill_options_handler.h" | 5 #include "chrome/browser/dom_ui/options/autofill_options_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // directly to CallJavascriptFunction(). | 308 // directly to CallJavascriptFunction(). |
| 309 ListValue credit_card_list; | 309 ListValue credit_card_list; |
| 310 DictionaryValue* credit_card_data = new DictionaryValue(); | 310 DictionaryValue* credit_card_data = new DictionaryValue(); |
| 311 credit_card_data->SetString("guid", credit_card->guid()); | 311 credit_card_data->SetString("guid", credit_card->guid()); |
| 312 credit_card_data->SetString( | 312 credit_card_data->SetString( |
| 313 "nameOnCard", | 313 "nameOnCard", |
| 314 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME))); | 314 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME))); |
| 315 credit_card_data->SetString( | 315 credit_card_data->SetString( |
| 316 "creditCardNumber", | 316 "creditCardNumber", |
| 317 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))); | 317 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))); |
| 318 credit_card_data->SetString("obfuscatedCardNumber", |
| 319 credit_card->ObfuscatedNumber()); |
| 318 credit_card_data->SetString( | 320 credit_card_data->SetString( |
| 319 "expirationMonth", | 321 "expirationMonth", |
| 320 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH))); | 322 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH))); |
| 321 credit_card_data->SetString( | 323 credit_card_data->SetString( |
| 322 "expirationYear", | 324 "expirationYear", |
| 323 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); | 325 credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); |
| 324 credit_card_list.Append(credit_card_data); | 326 credit_card_list.Append(credit_card_data); |
| 325 | 327 |
| 326 dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editCreditCard", | 328 dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editCreditCard", |
| 327 credit_card_list); | 329 credit_card_list); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (args->GetString(4, &value)) | 395 if (args->GetString(4, &value)) |
| 394 credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value); | 396 credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value); |
| 395 | 397 |
| 396 if (!guid::IsValidGUID(credit_card.guid())) { | 398 if (!guid::IsValidGUID(credit_card.guid())) { |
| 397 credit_card.set_guid(guid::GenerateGUID()); | 399 credit_card.set_guid(guid::GenerateGUID()); |
| 398 personal_data_->AddCreditCard(credit_card); | 400 personal_data_->AddCreditCard(credit_card); |
| 399 } else { | 401 } else { |
| 400 personal_data_->UpdateCreditCard(credit_card); | 402 personal_data_->UpdateCreditCard(credit_card); |
| 401 } | 403 } |
| 402 } | 404 } |
| OLD | NEW |