| 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 #include <memory> |
| 8 | 9 |
| 9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/ui/views/autofill/view_util.h" | 12 #include "chrome/browser/ui/views/autofill/view_util.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 13 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "components/autofill/core/browser/legal_message_line.h" | 14 #include "components/autofill/core/browser/legal_message_line.h" |
| 14 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" | 15 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" |
| 15 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Add the card type icon, last four digits and expiration date. | 187 // Add the card type icon, last four digits and expiration date. |
| 187 views::View* description_view = new views::View(); | 188 views::View* description_view = new views::View(); |
| 188 description_view->SetLayoutManager(new views::BoxLayout( | 189 description_view->SetLayoutManager(new views::BoxLayout( |
| 189 views::BoxLayout::kHorizontal, 0, 0, views::kRelatedButtonHSpacing)); | 190 views::BoxLayout::kHorizontal, 0, 0, views::kRelatedButtonHSpacing)); |
| 190 view->AddChildView(description_view); | 191 view->AddChildView(description_view); |
| 191 | 192 |
| 192 const CreditCard& card = controller_->GetCard(); | 193 const CreditCard& card = controller_->GetCard(); |
| 193 views::ImageView* card_type_icon = new views::ImageView(); | 194 views::ImageView* card_type_icon = new views::ImageView(); |
| 194 card_type_icon->SetImage( | 195 card_type_icon->SetImage( |
| 195 ResourceBundle::GetSharedInstance() | 196 ResourceBundle::GetSharedInstance() |
| 196 .GetImageNamed(CreditCard::IconResourceId(card.type())) | 197 .GetImageNamed(CreditCard::IconResourceId(card.network())) |
| 197 .AsImageSkia()); | 198 .AsImageSkia()); |
| 198 card_type_icon->SetTooltipText(card.TypeForDisplay()); | 199 card_type_icon->SetTooltipText(card.NetworkForDisplay()); |
| 199 card_type_icon->SetBorder( | 200 card_type_icon->SetBorder( |
| 200 views::CreateSolidBorder(1, SkColorSetA(SK_ColorBLACK, 10))); | 201 views::CreateSolidBorder(1, SkColorSetA(SK_ColorBLACK, 10))); |
| 201 description_view->AddChildView(card_type_icon); | 202 description_view->AddChildView(card_type_icon); |
| 202 | 203 |
| 203 description_view->AddChildView(new views::Label( | 204 description_view->AddChildView(new views::Label( |
| 204 base::string16(kMidlineEllipsis) + card.LastFourDigits())); | 205 base::string16(kMidlineEllipsis) + card.LastFourDigits())); |
| 205 description_view->AddChildView( | 206 description_view->AddChildView( |
| 206 new views::Label(card.AbbreviatedExpirationDateForDisplay())); | 207 new views::Label(card.AbbreviatedExpirationDateForDisplay())); |
| 207 | 208 |
| 208 // Optionally add CVC request field if CVC was missing. | 209 // Optionally add CVC request field if CVC was missing. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 DCHECK_EQ(cvc_textfield_, sender); | 257 DCHECK_EQ(cvc_textfield_, sender); |
| 257 GetDialogClientView()->UpdateDialogButtons(); | 258 GetDialogClientView()->UpdateDialogButtons(); |
| 258 } | 259 } |
| 259 | 260 |
| 260 void SaveCardBubbleViews::Init() { | 261 void SaveCardBubbleViews::Init() { |
| 261 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 262 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| 262 AddChildView(CreateMainContentView().release()); | 263 AddChildView(CreateMainContentView().release()); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace autofill | 266 } // namespace autofill |
| OLD | NEW |