| 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" |
| 11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | |
| 12 #include "chrome/browser/ui/autofill/save_card_bubble_controller.h" | 11 #include "chrome/browser/ui/autofill/save_card_bubble_controller.h" |
| 13 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
| 14 #include "components/autofill/core/browser/legal_message_line.h" | 13 #include "components/autofill/core/browser/legal_message_line.h" |
| 15 #include "grit/components_strings.h" | 14 #include "grit/components_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/views/border.h" | 17 #include "ui/views/border.h" |
| 19 #include "ui/views/bubble/bubble_frame_view.h" | 18 #include "ui/views/bubble/bubble_frame_view.h" |
| 20 #include "ui/views/controls/button/blue_button.h" | 19 #include "ui/views/controls/button/blue_button.h" |
| 21 #include "ui/views/controls/button/label_button.h" | 20 #include "ui/views/controls/button/label_button.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 view->AddChildView(description_view); | 179 view->AddChildView(description_view); |
| 181 | 180 |
| 182 const CreditCard& card = controller_->GetCard(); | 181 const CreditCard& card = controller_->GetCard(); |
| 183 views::ImageView* card_type_icon = new views::ImageView(); | 182 views::ImageView* card_type_icon = new views::ImageView(); |
| 184 card_type_icon->SetImage( | 183 card_type_icon->SetImage( |
| 185 ResourceBundle::GetSharedInstance() | 184 ResourceBundle::GetSharedInstance() |
| 186 .GetImageNamed(CreditCard::IconResourceId(card.type())) | 185 .GetImageNamed(CreditCard::IconResourceId(card.type())) |
| 187 .AsImageSkia()); | 186 .AsImageSkia()); |
| 188 card_type_icon->SetTooltipText(card.TypeForDisplay()); | 187 card_type_icon->SetTooltipText(card.TypeForDisplay()); |
| 189 card_type_icon->SetBorder( | 188 card_type_icon->SetBorder( |
| 190 views::Border::CreateSolidBorder(1, kSubtleBorderColor)); | 189 views::Border::CreateSolidBorder(1, SkColorSetA(SK_ColorBLACK, 10))); |
| 191 description_view->AddChildView(card_type_icon); | 190 description_view->AddChildView(card_type_icon); |
| 192 | 191 |
| 193 description_view->AddChildView(new views::Label( | 192 description_view->AddChildView(new views::Label( |
| 194 base::string16(kMidlineEllipsis) + card.LastFourDigits())); | 193 base::string16(kMidlineEllipsis) + card.LastFourDigits())); |
| 195 description_view->AddChildView( | 194 description_view->AddChildView( |
| 196 new views::Label(card.AbbreviatedExpirationDateForDisplay())); | 195 new views::Label(card.AbbreviatedExpirationDateForDisplay())); |
| 197 | 196 |
| 198 // Optionally add label that will contain an explanation for upload. | 197 // Optionally add label that will contain an explanation for upload. |
| 199 base::string16 explanation = controller_->GetExplanatoryMessage(); | 198 base::string16 explanation = controller_->GetExplanatoryMessage(); |
| 200 if (!explanation.empty()) { | 199 if (!explanation.empty()) { |
| 201 views::Label* explanation_label = new views::Label(explanation); | 200 views::Label* explanation_label = new views::Label(explanation); |
| 202 explanation_label->SetMultiLine(true); | 201 explanation_label->SetMultiLine(true); |
| 203 explanation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 202 explanation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 204 view->AddChildView(explanation_label); | 203 view->AddChildView(explanation_label); |
| 205 } | 204 } |
| 206 | 205 |
| 207 return view; | 206 return view; |
| 208 } | 207 } |
| 209 | 208 |
| 210 void SaveCardBubbleViews::Init() { | 209 void SaveCardBubbleViews::Init() { |
| 211 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 210 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| 212 AddChildView(CreateMainContentView().release()); | 211 AddChildView(CreateMainContentView().release()); |
| 213 } | 212 } |
| 214 | 213 |
| 215 } // namespace autofill | 214 } // namespace autofill |
| OLD | NEW |