Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_popup_layout_model.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 11 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 12 #include "chrome/browser/ui/autofill/popup_constants.h" | 12 #include "chrome/browser/ui/autofill/popup_constants.h" |
| 13 #include "components/autofill/core/browser/autofill_experiments.h" | 13 #include "components/autofill/core/browser/autofill_experiments.h" |
| 14 #include "components/autofill/core/browser/credit_card.h" | |
| 14 #include "components/autofill/core/browser/popup_item_ids.h" | 15 #include "components/autofill/core/browser/popup_item_ids.h" |
| 15 #include "components/autofill/core/browser/suggestion.h" | 16 #include "components/autofill/core/browser/suggestion.h" |
| 16 #include "components/autofill/core/common/autofill_util.h" | 17 #include "components/autofill/core/common/autofill_util.h" |
| 17 #include "components/grit/components_scaled_resources.h" | 18 #include "components/grit/components_scaled_resources.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/color_palette.h" | 21 #include "ui/gfx/color_palette.h" |
| 21 #include "ui/gfx/color_utils.h" | 22 #include "ui/gfx/color_utils.h" |
| 22 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
| 23 #include "ui/gfx/geometry/rect_conversions.h" | 24 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 42 // Size difference between the normal font and the smaller font, in pixels. | 43 // Size difference between the normal font and the smaller font, in pixels. |
| 43 const int kSmallerFontSizeDelta = -1; | 44 const int kSmallerFontSizeDelta = -1; |
| 44 | 45 |
| 45 const int kHttpWarningIconWidth = 16; | 46 const int kHttpWarningIconWidth = 16; |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 const struct { | 49 const struct { |
| 49 const char* name; | 50 const char* name; |
| 50 int id; | 51 int id; |
| 51 } kDataResources[] = { | 52 } kDataResources[] = { |
| 52 {"americanExpressCC", IDR_AUTOFILL_CC_AMEX}, | 53 {autofill::kAmericanExpressCard, IDR_AUTOFILL_CC_AMEX}, |
| 53 {"dinersCC", IDR_AUTOFILL_CC_GENERIC}, | 54 {autofill::kDinersCard, IDR_AUTOFILL_CC_DINERS}, |
|
Jared Saul
2017/05/31 18:26:23
Diners and JCB were both using "IDR_AUTOFILL_CC_GE
Mathieu
2017/05/31 18:27:24
I asked Jason to fix the bug. I updated the assets
jiahuiguo
2017/05/31 18:27:56
Yep, it was a previous bug.
| |
| 54 {"discoverCC", IDR_AUTOFILL_CC_DISCOVER}, | 55 {autofill::kDiscoverCard, IDR_AUTOFILL_CC_DISCOVER}, |
| 55 {"genericCC", IDR_AUTOFILL_CC_GENERIC}, | 56 {autofill::kEloCard, IDR_AUTOFILL_CC_ELO}, |
| 56 {"jcbCC", IDR_AUTOFILL_CC_GENERIC}, | 57 {autofill::kGenericCard, IDR_AUTOFILL_CC_GENERIC}, |
| 57 {"masterCardCC", IDR_AUTOFILL_CC_MASTERCARD}, | 58 {autofill::kJCBCard, IDR_AUTOFILL_CC_JCB}, |
| 58 {"mirCC", IDR_AUTOFILL_CC_MIR}, | 59 {autofill::kMasterCard, IDR_AUTOFILL_CC_MASTERCARD}, |
| 59 {"unionPayCC", IDR_AUTOFILL_CC_UNIONPAY}, | 60 {autofill::kMirCard, IDR_AUTOFILL_CC_MIR}, |
| 60 {"visaCC", IDR_AUTOFILL_CC_VISA}, | 61 {autofill::kUnionPay, IDR_AUTOFILL_CC_UNIONPAY}, |
| 62 {autofill::kVisaCard, IDR_AUTOFILL_CC_VISA}, | |
| 61 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
| 62 {"httpWarning", IDR_AUTOFILL_HTTP_WARNING}, | 64 {"httpWarning", IDR_AUTOFILL_HTTP_WARNING}, |
| 63 {"httpsInvalid", IDR_AUTOFILL_HTTPS_INVALID_WARNING}, | 65 {"httpsInvalid", IDR_AUTOFILL_HTTPS_INVALID_WARNING}, |
| 64 {"scanCreditCardIcon", IDR_AUTOFILL_CC_SCAN_NEW}, | 66 {"scanCreditCardIcon", IDR_AUTOFILL_CC_SCAN_NEW}, |
| 65 {"settings", IDR_AUTOFILL_SETTINGS}, | 67 {"settings", IDR_AUTOFILL_SETTINGS}, |
| 66 {"create", IDR_AUTOFILL_CREATE}, | 68 {"create", IDR_AUTOFILL_CREATE}, |
| 67 #endif | 69 #endif |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 int GetRowHeightFromId(int identifier) { | 72 int GetRowHeightFromId(int identifier) { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { | 304 bool AutofillPopupLayoutModel::IsIconAtStart(int frontend_id) const { |
| 303 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || | 305 return frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE || |
| 304 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); | 306 (is_credit_card_popup_ && IsIconInCreditCardPopupAtStart()); |
| 305 } | 307 } |
| 306 | 308 |
| 307 unsigned int AutofillPopupLayoutModel::GetMargin() const { | 309 unsigned int AutofillPopupLayoutModel::GetMargin() const { |
| 308 return GetPopupMargin(); | 310 return GetPopupMargin(); |
| 309 } | 311 } |
| 310 | 312 |
| 311 } // namespace autofill | 313 } // namespace autofill |
| OLD | NEW |