Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/ui/views/location_bar/keyword_hint_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
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), font_list) {
41 SetBorder(views::Border::CreateEmptyBorder( 41 SetBorder(views::CreateEmptyBorder(
42 gfx::Insets(GetLayoutConstant(LOCATION_BAR_BUBBLE_VERTICAL_PADDING), 0))); 42 gfx::Insets(GetLayoutConstant(LOCATION_BAR_BUBBLE_VERTICAL_PADDING), 0)));
43 } 43 }
44 44
45 TabKeyBubbleView::~TabKeyBubbleView() {} 45 TabKeyBubbleView::~TabKeyBubbleView() {}
46 46
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);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list, 143 views::Label* KeywordHintView::CreateLabel(const gfx::FontList& font_list,
144 SkColor text_color, 144 SkColor text_color,
145 SkColor background_color) { 145 SkColor background_color) {
146 views::Label* label = new views::Label(base::string16(), font_list); 146 views::Label* label = new views::Label(base::string16(), font_list);
147 label->SetEnabledColor(text_color); 147 label->SetEnabledColor(text_color);
148 label->SetBackgroundColor(background_color); 148 label->SetBackgroundColor(background_color);
149 AddChildView(label); 149 AddChildView(label);
150 return label; 150 return label;
151 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698