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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 bool IsRTL() const override { return false; } | 43 bool IsRTL() const override { return false; } |
| 44 | 44 |
| 45 const std::vector<autofill::Suggestion> GetSuggestions() override { | 45 const std::vector<autofill::Suggestion> GetSuggestions() override { |
| 46 // Give elements 1 and 3 subtexts and elements 2 and 3 icons, to ensure | 46 // Give elements 1 and 3 subtexts and elements 2 and 3 icons, to ensure |
| 47 // all combinations of subtexts and icons. | 47 // all combinations of subtexts and icons. |
| 48 std::vector<Suggestion> suggestions; | 48 std::vector<Suggestion> suggestions; |
| 49 suggestions.push_back(Suggestion("", "", "", 0)); | 49 suggestions.push_back(Suggestion("", "", "", 0)); |
| 50 suggestions.push_back(Suggestion("", "x", "", 0)); | 50 suggestions.push_back(Suggestion("", "x", "", 0)); |
| 51 suggestions.push_back(Suggestion("", "", "americanExpressCC", 0)); | 51 suggestions.push_back(Suggestion("", "", "americanExpressCC", 0)); |
| 52 suggestions.push_back(Suggestion("", "x", "genericCC", 0)); | 52 suggestions.push_back(Suggestion("", "x", "genericCC", 0)); |
| 53 // Http warning message. | |
| 54 suggestions.push_back(Suggestion("x", "x", "http", -10)); | |
|
Mathieu
2016/11/22 14:36:45
nit: use the popup_item_id enum instead of -10?
lshang
2016/11/27 04:59:13
Done.
| |
| 53 return suggestions; | 55 return suggestions; |
| 54 } | 56 } |
| 55 #if !defined(OS_ANDROID) | 57 #if !defined(OS_ANDROID) |
| 56 int GetElidedValueWidthForRow(size_t row) override { return 0; } | 58 int GetElidedValueWidthForRow(size_t row) override { return 0; } |
| 57 int GetElidedLabelWidthForRow(size_t row) override { return 0; } | 59 int GetElidedLabelWidthForRow(size_t row) override { return 0; } |
| 58 #endif | 60 #endif |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 gfx::RectF element_bounds_; | 63 gfx::RectF element_bounds_; |
| 62 gfx::NativeView container_view_; | 64 gfx::NativeView container_view_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 ui::ResourceBundle::GetSharedInstance() | 97 ui::ResourceBundle::GetSharedInstance() |
| 96 .GetImageNamed(IDR_AUTOFILL_CC_AMEX) | 98 .GetImageNamed(IDR_AUTOFILL_CC_AMEX) |
| 97 .Width(), | 99 .Width(), |
| 98 layout_model()->RowWidthWithoutText(2, /* with_label= */ false)); | 100 layout_model()->RowWidthWithoutText(2, /* with_label= */ false)); |
| 99 EXPECT_EQ(base_size + subtext_increase + | 101 EXPECT_EQ(base_size + subtext_increase + |
| 100 AutofillPopupLayoutModel::kIconPadding + | 102 AutofillPopupLayoutModel::kIconPadding + |
| 101 ui::ResourceBundle::GetSharedInstance() | 103 ui::ResourceBundle::GetSharedInstance() |
| 102 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) | 104 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) |
| 103 .Width(), | 105 .Width(), |
| 104 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); | 106 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); |
| 107 EXPECT_EQ(base_size + AutofillPopupLayoutModel::kHttpWarningNamePadding + | |
| 108 AutofillPopupLayoutModel::kHttpWarningIconPadding + | |
| 109 ui::ResourceBundle::GetSharedInstance() | |
| 110 .GetImageNamed(IDR_AUTOFILL_HTTP_WARNING) | |
| 111 .Width(), | |
| 112 layout_model()->RowWidthWithoutText(4, /* with_label= */ true)); | |
| 105 } | 113 } |
| 106 #endif | 114 #endif |
| 107 | 115 |
| 108 } // namespace autofill | 116 } // namespace autofill |
| OLD | NEW |