OLD | NEW |
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/new_credit_card_bubble_controller.h" | 5 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 DCHECK(billing_profile); | 93 DCHECK(billing_profile); |
94 | 94 |
95 new_card_ = std::move(new_card); | 95 new_card_ = std::move(new_card); |
96 billing_profile_ = std::move(billing_profile); | 96 billing_profile_ = std::move(billing_profile); |
97 | 97 |
98 const base::string16 card_number = | 98 const base::string16 card_number = |
99 new_card_->GetRawInfo(CREDIT_CARD_NUMBER); | 99 new_card_->GetRawInfo(CREDIT_CARD_NUMBER); |
100 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 100 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
101 card_desc_.icon = rb.GetImageNamed( | 101 card_desc_.icon = rb.GetImageNamed( |
102 CreditCard::IconResourceId(CreditCard::GetCreditCardType(card_number))); | 102 CreditCard::IconResourceId(CreditCard::GetCreditCardType(card_number))); |
103 card_desc_.name = new_card_->TypeAndLastFourDigits(); | 103 card_desc_.name = new_card_->TypeAndLastFourDigitsForDisplay(); |
104 | 104 |
105 AutofillProfileWrapper wrapper(billing_profile_.get()); | 105 AutofillProfileWrapper wrapper(billing_profile_.get()); |
106 base::string16 unused; | 106 base::string16 unused; |
107 wrapper.GetDisplayText(&card_desc_.description, &unused); | 107 wrapper.GetDisplayText(&card_desc_.description, &unused); |
108 | 108 |
109 bubble_ = CreateBubble(); | 109 bubble_ = CreateBubble(); |
110 if (!bubble_) { | 110 if (!bubble_) { |
111 // TODO(dbeam): Make a bubble on all applicable platforms. | 111 // TODO(dbeam): Make a bubble on all applicable platforms. |
112 delete this; | 112 delete this; |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 bubble_->Show(); | 116 bubble_->Show(); |
117 } | 117 } |
118 | 118 |
119 void NewCreditCardBubbleController::Hide() { | 119 void NewCreditCardBubbleController::Hide() { |
120 if (bubble_) | 120 if (bubble_) |
121 bubble_->Hide(); | 121 bubble_->Hide(); |
122 } | 122 } |
123 | 123 |
124 } // namespace autofill | 124 } // namespace autofill |
OLD | NEW |