Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Side by Side Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/webui/options/autofill_options_handler.h" 5 #include "chrome/browser/ui/webui/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 // Get the multi-valued element for |type| and return it in |ListValue| form. 95 // Get the multi-valued element for |type| and return it in |ListValue| form.
96 void GetValueList(const AutofillProfile& profile, 96 void GetValueList(const AutofillProfile& profile,
97 AutofillFieldType type, 97 AutofillFieldType type,
98 scoped_ptr<ListValue>* list) { 98 scoped_ptr<ListValue>* list) {
99 std::vector<string16> values; 99 std::vector<string16> values;
100 profile.GetMultiInfo(type, &values); 100 profile.GetMultiInfo(type, &values);
101 list->reset(new ListValue); 101 list->reset(new ListValue);
102 for (size_t i = 0; i < values.size(); ++i) { 102 for (size_t i = 0; i < values.size(); ++i) {
103 (*list)->Set(i, Value::CreateStringValue(values[i])); 103 (*list)->Set(i, base::StringValue::New(values[i]));
104 } 104 }
105 } 105 }
106 106
107 // Set the multi-valued element for |type| from input |list| values. 107 // Set the multi-valued element for |type| from input |list| values.
108 void SetValueList(const ListValue* list, 108 void SetValueList(const ListValue* list,
109 AutofillFieldType type, 109 AutofillFieldType type,
110 AutofillProfile* profile) { 110 AutofillProfile* profile) {
111 std::vector<string16> values(list->GetSize()); 111 std::vector<string16> values(list->GetSize());
112 for (size_t i = 0; i < list->GetSize(); ++i) { 112 for (size_t i = 0; i < list->GetSize(); ++i) {
113 string16 value; 113 string16 value;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 void AutofillOptionsHandler::LoadAutofillData() { 316 void AutofillOptionsHandler::LoadAutofillData() {
317 if (!personal_data_->IsDataLoaded()) 317 if (!personal_data_->IsDataLoaded())
318 return; 318 return;
319 319
320 ListValue addresses; 320 ListValue addresses;
321 for (std::vector<AutofillProfile*>::const_iterator i = 321 for (std::vector<AutofillProfile*>::const_iterator i =
322 personal_data_->web_profiles().begin(); 322 personal_data_->web_profiles().begin();
323 i != personal_data_->web_profiles().end(); ++i) { 323 i != personal_data_->web_profiles().end(); ++i) {
324 ListValue* entry = new ListValue(); 324 ListValue* entry = new ListValue();
325 entry->Append(new StringValue((*i)->guid())); 325 entry->Append(base::StringValue::New((*i)->guid()));
326 entry->Append(new StringValue((*i)->Label())); 326 entry->Append(base::StringValue::New((*i)->Label()));
327 addresses.Append(entry); 327 addresses.Append(entry);
328 } 328 }
329 329
330 web_ui_->CallJavascriptFunction("AutofillOptions.setAddressList", addresses); 330 web_ui_->CallJavascriptFunction("AutofillOptions.setAddressList", addresses);
331 331
332 ListValue credit_cards; 332 ListValue credit_cards;
333 for (std::vector<CreditCard*>::const_iterator i = 333 for (std::vector<CreditCard*>::const_iterator i =
334 personal_data_->credit_cards().begin(); 334 personal_data_->credit_cards().begin();
335 i != personal_data_->credit_cards().end(); ++i) { 335 i != personal_data_->credit_cards().end(); ++i) {
336 ListValue* entry = new ListValue(); 336 ListValue* entry = new ListValue();
337 entry->Append(new StringValue((*i)->guid())); 337 entry->Append(base::StringValue::New((*i)->guid()));
338 entry->Append(new StringValue((*i)->Label())); 338 entry->Append(base::StringValue::New((*i)->Label()));
339 int res = CreditCardTypeToResourceID((*i)->type()); 339 int res = CreditCardTypeToResourceID((*i)->type());
340 entry->Append( 340 entry->Append(
341 new StringValue(web_ui_util::GetImageDataUrlFromResource(res))); 341 base::StringValue::New(web_ui_util::GetImageDataUrlFromResource(res)));
342 entry->Append(new StringValue(LocalizedCreditCardType((*i)->type()))); 342 entry->Append(
343 base::StringValue::New(LocalizedCreditCardType((*i)->type())));
343 credit_cards.Append(entry); 344 credit_cards.Append(entry);
344 } 345 }
345 346
346 web_ui_->CallJavascriptFunction("AutofillOptions.setCreditCardList", 347 web_ui_->CallJavascriptFunction("AutofillOptions.setCreditCardList",
347 credit_cards); 348 credit_cards);
348 } 349 }
349 350
350 void AutofillOptionsHandler::RemoveAddress(const ListValue* args) { 351 void AutofillOptionsHandler::RemoveAddress(const ListValue* args) {
351 DCHECK(personal_data_->IsDataLoaded()); 352 DCHECK(personal_data_->IsDataLoaded());
352 353
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) { 538 void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) {
538 if (!personal_data_->IsDataLoaded()) 539 if (!personal_data_->IsDataLoaded())
539 return; 540 return;
540 541
541 ListValue* list_value = NULL; 542 ListValue* list_value = NULL;
542 ValidatePhoneArguments(args, &list_value); 543 ValidatePhoneArguments(args, &list_value);
543 544
544 web_ui_->CallJavascriptFunction( 545 web_ui_->CallJavascriptFunction(
545 "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value); 546 "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value);
546 } 547 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698