OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/autofill/save_card_bubble_views.h" | 5 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 view->AddChildView(description_view); | 185 view->AddChildView(description_view); |
186 | 186 |
187 const CreditCard& card = controller_->GetCard(); | 187 const CreditCard& card = controller_->GetCard(); |
188 views::ImageView* card_type_icon = new views::ImageView(); | 188 views::ImageView* card_type_icon = new views::ImageView(); |
189 card_type_icon->SetImage( | 189 card_type_icon->SetImage( |
190 ResourceBundle::GetSharedInstance() | 190 ResourceBundle::GetSharedInstance() |
191 .GetImageNamed(CreditCard::IconResourceId(card.type())) | 191 .GetImageNamed(CreditCard::IconResourceId(card.type())) |
192 .AsImageSkia()); | 192 .AsImageSkia()); |
193 card_type_icon->SetTooltipText(card.TypeForDisplay()); | 193 card_type_icon->SetTooltipText(card.TypeForDisplay()); |
194 card_type_icon->SetBorder( | 194 card_type_icon->SetBorder( |
195 views::Border::CreateSolidBorder(1, SkColorSetA(SK_ColorBLACK, 10))); | 195 views::CreateSolidBorder(1, SkColorSetA(SK_ColorBLACK, 10))); |
196 description_view->AddChildView(card_type_icon); | 196 description_view->AddChildView(card_type_icon); |
197 | 197 |
198 description_view->AddChildView(new views::Label( | 198 description_view->AddChildView(new views::Label( |
199 base::string16(kMidlineEllipsis) + card.LastFourDigits())); | 199 base::string16(kMidlineEllipsis) + card.LastFourDigits())); |
200 description_view->AddChildView( | 200 description_view->AddChildView( |
201 new views::Label(card.AbbreviatedExpirationDateForDisplay())); | 201 new views::Label(card.AbbreviatedExpirationDateForDisplay())); |
202 | 202 |
203 // Optionally add label that will contain an explanation for upload. | 203 // Optionally add label that will contain an explanation for upload. |
204 base::string16 explanation = controller_->GetExplanatoryMessage(); | 204 base::string16 explanation = controller_->GetExplanatoryMessage(); |
205 if (!explanation.empty()) { | 205 if (!explanation.empty()) { |
206 views::Label* explanation_label = new views::Label(explanation); | 206 views::Label* explanation_label = new views::Label(explanation); |
207 explanation_label->SetMultiLine(true); | 207 explanation_label->SetMultiLine(true); |
208 explanation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 208 explanation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
209 view->AddChildView(explanation_label); | 209 view->AddChildView(explanation_label); |
210 } | 210 } |
211 | 211 |
212 return view; | 212 return view; |
213 } | 213 } |
214 | 214 |
215 void SaveCardBubbleViews::Init() { | 215 void SaveCardBubbleViews::Init() { |
216 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 216 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
217 AddChildView(CreateMainContentView().release()); | 217 AddChildView(CreateMainContentView().release()); |
218 } | 218 } |
219 | 219 |
220 } // namespace autofill | 220 } // namespace autofill |
OLD | NEW |