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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 112913004: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 return !previously_selected_id.empty() ? previously_selected_id : default_id; 470 return !previously_selected_id.empty() ? previously_selected_id : default_id;
471 } 471 }
472 472
473 // Generate a random card number in a user displayable format. 473 // Generate a random card number in a user displayable format.
474 base::string16 GenerateRandomCardNumber() { 474 base::string16 GenerateRandomCardNumber() {
475 std::string card_number; 475 std::string card_number;
476 for (size_t i = 0; i < 4; ++i) { 476 for (size_t i = 0; i < 4; ++i) {
477 int part = base::RandInt(0, 10000); 477 int part = base::RandInt(0, 10000);
478 base::StringAppendF(&card_number, "%04d ", part); 478 base::StringAppendF(&card_number, "%04d ", part);
479 } 479 }
480 return ASCIIToUTF16(card_number); 480 return base::ASCIIToUTF16(card_number);
481 } 481 }
482 482
483 gfx::Image CreditCardIconForType(const std::string& credit_card_type) { 483 gfx::Image CreditCardIconForType(const std::string& credit_card_type) {
484 const int input_card_idr = CreditCard::IconResourceId(credit_card_type); 484 const int input_card_idr = CreditCard::IconResourceId(credit_card_type);
485 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 485 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
486 gfx::Image result = rb.GetImageNamed(input_card_idr); 486 gfx::Image result = rb.GetImageNamed(input_card_idr);
487 if (input_card_idr == IDR_AUTOFILL_CC_GENERIC) { 487 if (input_card_idr == IDR_AUTOFILL_CC_GENERIC) {
488 // When the credit card type is unknown, no image should be shown. However, 488 // When the credit card type is unknown, no image should be shown. However,
489 // to simplify the view code on Mac, save space for the credit card image by 489 // to simplify the view code on Mac, save space for the credit card image by
490 // returning a transparent image of the appropriate size. Not all credit 490 // returning a transparent image of the appropriate size. Not all credit
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 const SkColor final_bottom_color = SkColorSetRGB(0x22, 0x75, 0xE5); 803 const SkColor final_bottom_color = SkColorSetRGB(0x22, 0x75, 0xE5);
804 804
805 if (full_wallet_ && full_wallet_->required_actions().empty()) { 805 if (full_wallet_ && full_wallet_->required_actions().empty()) {
806 card_scrambling_delay_.Stop(); 806 card_scrambling_delay_.Stop();
807 card_scrambling_refresher_.Stop(); 807 card_scrambling_refresher_.Stop();
808 808
809 base::string16 cc_number = 809 base::string16 cc_number =
810 full_wallet_->GetInfo(AutofillType(CREDIT_CARD_NUMBER)); 810 full_wallet_->GetInfo(AutofillType(CREDIT_CARD_NUMBER));
811 DCHECK_GE(cc_number.size(), 4U); 811 DCHECK_GE(cc_number.size(), 4U);
812 state.image = GetGeneratedCardImage( 812 state.image = GetGeneratedCardImage(
813 ASCIIToUTF16("XXXX XXXX XXXX ") + 813 base::ASCIIToUTF16("XXXX XXXX XXXX ") +
814 cc_number.substr(cc_number.size() - 4), 814 cc_number.substr(cc_number.size() - 4),
815 full_wallet_->billing_address()->recipient_name(), 815 full_wallet_->billing_address()->recipient_name(),
816 color_utils::AlphaBlend( 816 color_utils::AlphaBlend(
817 final_top_color, 817 final_top_color,
818 start_top_color, 818 start_top_color,
819 255 * card_generated_animation_.GetCurrentValue()), 819 255 * card_generated_animation_.GetCurrentValue()),
820 color_utils::AlphaBlend( 820 color_utils::AlphaBlend(
821 final_bottom_color, 821 final_bottom_color,
822 start_bottom_color, 822 start_bottom_color,
823 255 * card_generated_animation_.GetCurrentValue())); 823 255 * card_generated_animation_.GetCurrentValue()));
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 if (IsPayingWithWallet() && !wallet::IsUsingProd()) { 1991 if (IsPayingWithWallet() && !wallet::IsUsingProd()) {
1992 notifications.push_back(DialogNotification( 1992 notifications.push_back(DialogNotification(
1993 DialogNotification::DEVELOPER_WARNING, 1993 DialogNotification::DEVELOPER_WARNING,
1994 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_NOT_PROD_WARNING))); 1994 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_NOT_PROD_WARNING)));
1995 } 1995 }
1996 1996
1997 if (!invoked_from_same_origin_) { 1997 if (!invoked_from_same_origin_) {
1998 notifications.push_back(DialogNotification( 1998 notifications.push_back(DialogNotification(
1999 DialogNotification::SECURITY_WARNING, 1999 DialogNotification::SECURITY_WARNING,
2000 l10n_util::GetStringFUTF16(IDS_AUTOFILL_DIALOG_SITE_WARNING, 2000 l10n_util::GetStringFUTF16(IDS_AUTOFILL_DIALOG_SITE_WARNING,
2001 UTF8ToUTF16(source_url_.host())))); 2001 base::UTF8ToUTF16(source_url_.host()))));
2002 } 2002 }
2003 2003
2004 return notifications; 2004 return notifications;
2005 } 2005 }
2006 2006
2007 void AutofillDialogControllerImpl::LinkClicked(const GURL& url) { 2007 void AutofillDialogControllerImpl::LinkClicked(const GURL& url) {
2008 OpenTabWithUrl(url); 2008 OpenTabWithUrl(url);
2009 } 2009 }
2010 2010
2011 void AutofillDialogControllerImpl::SignInLinkClicked() { 2011 void AutofillDialogControllerImpl::SignInLinkClicked() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 DCHECK(!backing_card_last_four_.empty()); 2096 DCHECK(!backing_card_last_four_.empty());
2097 } 2097 }
2098 2098
2099 SetIsSubmitting(true); 2099 SetIsSubmitting(true);
2100 2100
2101 if (IsSubmitPausedOn(wallet::VERIFY_CVV)) { 2101 if (IsSubmitPausedOn(wallet::VERIFY_CVV)) {
2102 DCHECK(!active_instrument_id_.empty()); 2102 DCHECK(!active_instrument_id_.empty());
2103 full_wallet_.reset(); 2103 full_wallet_.reset();
2104 GetWalletClient()->AuthenticateInstrument( 2104 GetWalletClient()->AuthenticateInstrument(
2105 active_instrument_id_, 2105 active_instrument_id_,
2106 UTF16ToUTF8(view_->GetCvc())); 2106 base::UTF16ToUTF8(view_->GetCvc()));
2107 view_->UpdateOverlay(); 2107 view_->UpdateOverlay();
2108 } else if (IsPayingWithWallet()) { 2108 } else if (IsPayingWithWallet()) {
2109 AcceptLegalTerms(); 2109 AcceptLegalTerms();
2110 } else { 2110 } else {
2111 FinishSubmit(); 2111 FinishSubmit();
2112 } 2112 }
2113 2113
2114 return false; 2114 return false;
2115 } 2115 }
2116 2116
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 } 2723 }
2724 2724
2725 suggested_cc_billing_.AddKeyedItem( 2725 suggested_cc_billing_.AddKeyedItem(
2726 kAddNewItemKey, 2726 kAddNewItemKey,
2727 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); 2727 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS));
2728 if (!wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) { 2728 if (!wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) {
2729 suggested_cc_billing_.AddKeyedItemWithMinorText( 2729 suggested_cc_billing_.AddKeyedItemWithMinorText(
2730 kManageItemsKey, 2730 kManageItemsKey,
2731 l10n_util::GetStringUTF16( 2731 l10n_util::GetStringUTF16(
2732 IDS_AUTOFILL_DIALOG_MANAGE_BILLING_DETAILS), 2732 IDS_AUTOFILL_DIALOG_MANAGE_BILLING_DETAILS),
2733 UTF8ToUTF16(wallet::GetManageInstrumentsUrl(0U).host())); 2733 base::UTF8ToUTF16(wallet::GetManageInstrumentsUrl(0U).host()));
2734 } 2734 }
2735 2735
2736 // Determine which instrument item should be selected. 2736 // Determine which instrument item should be selected.
2737 if (!default_instrument_key.empty()) 2737 if (!default_instrument_key.empty())
2738 suggested_cc_billing_.SetCheckedItem(default_instrument_key); 2738 suggested_cc_billing_.SetCheckedItem(default_instrument_key);
2739 else if (!first_active_instrument_key.empty()) 2739 else if (!first_active_instrument_key.empty())
2740 suggested_cc_billing_.SetCheckedItem(first_active_instrument_key); 2740 suggested_cc_billing_.SetCheckedItem(first_active_instrument_key);
2741 else 2741 else
2742 suggested_cc_billing_.SetCheckedItem(kAddNewItemKey); 2742 suggested_cc_billing_.SetCheckedItem(kAddNewItemKey);
2743 } 2743 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 kAddNewItemKey, 2794 kAddNewItemKey,
2795 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_SHIPPING_ADDRESS)); 2795 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_SHIPPING_ADDRESS));
2796 if (!IsPayingWithWallet()) { 2796 if (!IsPayingWithWallet()) {
2797 suggested_shipping_.AddKeyedItem( 2797 suggested_shipping_.AddKeyedItem(
2798 kManageItemsKey, 2798 kManageItemsKey,
2799 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS)); 2799 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS));
2800 } else if (!wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) { 2800 } else if (!wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) {
2801 suggested_shipping_.AddKeyedItemWithMinorText( 2801 suggested_shipping_.AddKeyedItemWithMinorText(
2802 kManageItemsKey, 2802 kManageItemsKey,
2803 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS), 2803 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS),
2804 UTF8ToUTF16(wallet::GetManageAddressesUrl(0U).host())); 2804 base::UTF8ToUTF16(wallet::GetManageAddressesUrl(0U).host()));
2805 } 2805 }
2806 2806
2807 if (!IsPayingWithWallet()) { 2807 if (!IsPayingWithWallet()) {
2808 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { 2808 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
2809 DialogSection section = static_cast<DialogSection>(i); 2809 DialogSection section = static_cast<DialogSection>(i);
2810 if (!SectionIsActive(section)) 2810 if (!SectionIsActive(section))
2811 continue; 2811 continue;
2812 2812
2813 // Set the starting choice for the menu. First set to the default in case 2813 // Set the starting choice for the menu. First set to the default in case
2814 // the GUID saved in prefs refers to a profile that no longer exists. 2814 // the GUID saved in prefs refers to a profile that no longer exists.
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 view_->UpdateButtonStrip(); 3538 view_->UpdateButtonStrip();
3539 } 3539 }
3540 3540
3541 void AutofillDialogControllerImpl::FetchWalletCookie() { 3541 void AutofillDialogControllerImpl::FetchWalletCookie() {
3542 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 3542 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
3543 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 3543 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
3544 signin_helper_->StartWalletCookieValueFetch(); 3544 signin_helper_->StartWalletCookieValueFetch();
3545 } 3545 }
3546 3546
3547 } // namespace autofill 3547 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698