OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/location_bar/keyword_hint_view.h" | 5 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 ~TabKeyBubbleView() override; | 30 ~TabKeyBubbleView() override; |
31 | 31 |
32 private: | 32 private: |
33 // views::Label: | 33 // views::Label: |
34 gfx::Size GetPreferredSize() const override; | 34 gfx::Size GetPreferredSize() const override; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(TabKeyBubbleView); | 36 DISALLOW_COPY_AND_ASSIGN(TabKeyBubbleView); |
37 }; | 37 }; |
38 | 38 |
39 TabKeyBubbleView::TabKeyBubbleView(const gfx::FontList& font_list) | 39 TabKeyBubbleView::TabKeyBubbleView(const gfx::FontList& font_list) |
40 : views::Label(l10n_util::GetStringUTF16(IDS_APP_TAB_KEY), font_list) { | 40 : views::Label(l10n_util::GetStringUTF16(IDS_APP_TAB_KEY), |
| 41 views::Label::CustomFont{font_list}) { |
41 SetBorder(views::CreateEmptyBorder( | 42 SetBorder(views::CreateEmptyBorder( |
42 gfx::Insets(LocationBarView::kBubbleVerticalPadding, 0))); | 43 gfx::Insets(LocationBarView::kBubbleVerticalPadding, 0))); |
43 } | 44 } |
44 | 45 |
45 TabKeyBubbleView::~TabKeyBubbleView() {} | 46 TabKeyBubbleView::~TabKeyBubbleView() {} |
46 | 47 |
47 gfx::Size TabKeyBubbleView::GetPreferredSize() const { | 48 gfx::Size TabKeyBubbleView::GetPreferredSize() const { |
48 gfx::Size size = views::Label::GetPreferredSize(); | 49 gfx::Size size = views::Label::GetPreferredSize(); |
49 constexpr int kPaddingInsideBorder = 5; | 50 constexpr int kPaddingInsideBorder = 5; |
50 // Even though the border is 1 px thick visibly, it takes 1 DIP logically. | 51 // Even though the border is 1 px thick visibly, it takes 1 DIP logically. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 show_labels ? trailing_size.width() : 0, height()); | 138 show_labels ? trailing_size.width() : 0, height()); |
138 } | 139 } |
139 | 140 |
140 const char* KeywordHintView::GetClassName() const { | 141 const char* KeywordHintView::GetClassName() const { |
141 return "KeywordHintView"; | 142 return "KeywordHintView"; |
142 } | 143 } |
143 | 144 |
144 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, | 145 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, |
145 SkColor text_color, | 146 SkColor text_color, |
146 SkColor background_color) { | 147 SkColor background_color) { |
147 views::Label* label = new views::Label(base::string16(), font_list); | 148 views::Label* label = |
| 149 new views::Label(base::string16(), views::Label::CustomFont{font_list}); |
148 label->SetEnabledColor(text_color); | 150 label->SetEnabledColor(text_color); |
149 label->SetBackgroundColor(background_color); | 151 label->SetBackgroundColor(background_color); |
150 AddChildView(label); | 152 AddChildView(label); |
151 return label; | 153 return label; |
152 } | 154 } |
OLD | NEW |