| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 gfx::Size TabKeyBubbleView::GetPreferredSize() const { | 47 gfx::Size TabKeyBubbleView::GetPreferredSize() const { |
| 48 gfx::Size size = views::Label::GetPreferredSize(); | 48 gfx::Size size = views::Label::GetPreferredSize(); |
| 49 constexpr int kPaddingInsideBorder = 5; | 49 constexpr int kPaddingInsideBorder = 5; |
| 50 // Even though the border is 1 px thick visibly, it takes 1 DIP logically. | 50 // Even though the border is 1 px thick visibly, it takes 1 DIP logically. |
| 51 size.Enlarge(2 * (kPaddingInsideBorder + 1), 0); | 51 size.Enlarge(2 * (kPaddingInsideBorder + 1), 0); |
| 52 return size; | 52 return size; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 KeywordHintView::KeywordHintView(Profile* profile, | 57 KeywordHintView::KeywordHintView(views::ButtonListener* listener, |
| 58 Profile* profile, |
| 58 const gfx::FontList& font_list, | 59 const gfx::FontList& font_list, |
| 59 const gfx::FontList& bubble_font_list, | 60 const gfx::FontList& bubble_font_list, |
| 60 int bubble_height, | 61 int bubble_height, |
| 61 SkColor text_color, | 62 SkColor text_color, |
| 62 SkColor background_color) | 63 SkColor background_color) |
| 63 : profile_(profile), | 64 : CustomButton(listener), |
| 65 profile_(profile), |
| 64 leading_label_(nullptr), | 66 leading_label_(nullptr), |
| 65 tab_key_view_(nullptr), | 67 tab_key_view_(nullptr), |
| 66 trailing_label_(nullptr), | 68 trailing_label_(nullptr), |
| 67 tab_key_height_(bubble_height) { | 69 tab_key_height_(bubble_height) { |
| 68 leading_label_ = | 70 leading_label_ = |
| 69 CreateLabel(font_list, text_color, background_color); | 71 CreateLabel(font_list, text_color, background_color); |
| 70 TabKeyBubbleView* tab_key = new TabKeyBubbleView(bubble_font_list); | 72 TabKeyBubbleView* tab_key = new TabKeyBubbleView(bubble_font_list); |
| 71 tab_key->SetEnabledColor(text_color); | 73 tab_key->SetEnabledColor(text_color); |
| 72 bool inverted = color_utils::IsDark(background_color); | 74 bool inverted = color_utils::IsDark(background_color); |
| 73 SkColor tab_bg_color = | 75 SkColor tab_bg_color = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 145 |
| 144 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, | 146 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, |
| 145 SkColor text_color, | 147 SkColor text_color, |
| 146 SkColor background_color) { | 148 SkColor background_color) { |
| 147 views::Label* label = new views::Label(base::string16(), {font_list}); | 149 views::Label* label = new views::Label(base::string16(), {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 |