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

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

Issue 14564003: Make PersonalDataManager use GetCreditCards() (rather than using credit_cards_ directly) so Autofill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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) 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/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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 i != personal_data_->web_profiles().end(); ++i) { 382 i != personal_data_->web_profiles().end(); ++i) {
383 ListValue* entry = new ListValue(); 383 ListValue* entry = new ListValue();
384 entry->Append(new StringValue((*i)->guid())); 384 entry->Append(new StringValue((*i)->guid()));
385 entry->Append(new StringValue((*i)->Label())); 385 entry->Append(new StringValue((*i)->Label()));
386 addresses.Append(entry); 386 addresses.Append(entry);
387 } 387 }
388 388
389 web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList", addresses); 389 web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList", addresses);
390 390
391 ListValue credit_cards; 391 ListValue credit_cards;
392 for (std::vector<CreditCard*>::const_iterator i = 392 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards();
393 personal_data_->credit_cards().begin(); 393 for (std::vector<CreditCard*>::const_iterator iter = cards.begin();
394 i != personal_data_->credit_cards().end(); ++i) { 394 iter != cards.end(); ++iter) {
395 const CreditCard* card = *i; 395 const CreditCard* card = *iter;
396 // TODO(estade): this should be a dictionary. 396 // TODO(estade): this should be a dictionary.
397 ListValue* entry = new ListValue(); 397 ListValue* entry = new ListValue();
398 entry->Append(new StringValue(card->guid())); 398 entry->Append(new StringValue(card->guid()));
399 entry->Append(new StringValue(card->Label())); 399 entry->Append(new StringValue(card->Label()));
400 entry->Append(new StringValue( 400 entry->Append(new StringValue(
401 webui::GetBitmapDataUrlFromResource(card->IconResourceId()))); 401 webui::GetBitmapDataUrlFromResource(card->IconResourceId())));
402 entry->Append(new StringValue(card->TypeForDisplay())); 402 entry->Append(new StringValue(card->TypeForDisplay()));
403 credit_cards.Append(entry); 403 credit_cards.Append(entry);
404 } 404 }
405 405
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 595
596 web_ui()->CallJavascriptFunction( 596 web_ui()->CallJavascriptFunction(
597 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); 597 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value);
598 } 598 }
599 599
600 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { 600 bool AutofillOptionsHandler::IsPersonalDataLoaded() const {
601 return personal_data_ && personal_data_->IsDataLoaded(); 601 return personal_data_ && personal_data_->IsDataLoaded();
602 } 602 }
603 603
604 } // namespace options 604 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698