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

Side by Side Diff: ui/views/controls/styled_label.h

Issue 147533005: [Password Generation] Update UI to match final mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replace_password_generation_ui
Patch Set: Unittests Created 6 years, 10 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_STYLED_LABEL_H_
6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 #include "ui/gfx/font_list.h"
14 #include "ui/gfx/range/range.h" 15 #include "ui/gfx/range/range.h"
15 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
16 #include "ui/views/controls/link_listener.h" 17 #include "ui/views/controls/link_listener.h"
17 #include "ui/views/view.h" 18 #include "ui/views/view.h"
18 19
19 namespace views { 20 namespace views {
20 21
21 class Link; 22 class Link;
22 class StyledLabelListener; 23 class StyledLabelListener;
23 24
(...skipping 29 matching lines...) Expand all
53 bool is_link; 54 bool is_link;
54 }; 55 };
55 56
56 // Note that any trailing whitespace in |text| will be trimmed. 57 // Note that any trailing whitespace in |text| will be trimmed.
57 StyledLabel(const base::string16& text, StyledLabelListener* listener); 58 StyledLabel(const base::string16& text, StyledLabelListener* listener);
58 virtual ~StyledLabel(); 59 virtual ~StyledLabel();
59 60
60 // Sets the text to be displayed, and clears any previous styling. 61 // Sets the text to be displayed, and clears any previous styling.
61 void SetText(const base::string16& text); 62 void SetText(const base::string16& text);
62 63
64 // Sets the fonts used by all labels. Can be augemented by styling set by
65 // AddStyleRange and SetDefaultStyle.
66 void SetBaseFontList(const gfx::FontList& font_list);
67
63 // Marks the given range within |text_| with style defined by |style_info|. 68 // Marks the given range within |text_| with style defined by |style_info|.
64 // |range| must be contained in |text_|. 69 // |range| must be contained in |text_|.
65 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); 70 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info);
66 71
67 // Sets the default style to use for any part of the text that isn't within 72 // Sets the default style to use for any part of the text that isn't within
68 // a range set by AddStyleRange. 73 // a range set by AddStyleRange.
69 void SetDefaultStyle(const RangeStyleInfo& style_info); 74 void SetDefaultStyle(const RangeStyleInfo& style_info);
70 75
71 // Sets the color of the background on which the label is drawn. This won't 76 // Sets the color of the background on which the label is drawn. This won't
72 // be explicitly drawn, but the label will force the text color to be 77 // be explicitly drawn, but the label will force the text color to be
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 112
108 // Calculates how to layout child views, creates them and sets their size 113 // Calculates how to layout child views, creates them and sets their size
109 // and position. |width| is the horizontal space, in pixels, that the view 114 // and position. |width| is the horizontal space, in pixels, that the view
110 // has to work with. If |dry_run| is true, the view hierarchy is not touched. 115 // has to work with. If |dry_run| is true, the view hierarchy is not touched.
111 // The return value is the necessary size. 116 // The return value is the necessary size.
112 gfx::Size CalculateAndDoLayout(int width, bool dry_run); 117 gfx::Size CalculateAndDoLayout(int width, bool dry_run);
113 118
114 // The text to display. 119 // The text to display.
115 base::string16 text_; 120 base::string16 text_;
116 121
122 // Fonts used to display text. Can be augmented by RangeStyleInfo.
123 gfx::FontList font_list_;
124
117 // The default style to use for any part of the text that isn't within 125 // The default style to use for any part of the text that isn't within
118 // a range in |style_ranges_|. 126 // a range in |style_ranges_|.
119 RangeStyleInfo default_style_info_; 127 RangeStyleInfo default_style_info_;
120 128
121 // The listener that will be informed of link clicks. 129 // The listener that will be informed of link clicks.
122 StyledLabelListener* listener_; 130 StyledLabelListener* listener_;
123 131
124 // The ranges that should be linkified, sorted by start position. 132 // The ranges that should be linkified, sorted by start position.
125 StyleRanges style_ranges_; 133 StyleRanges style_ranges_;
126 134
(...skipping 12 matching lines...) Expand all
139 // Controls whether the text is automatically re-colored to be readable on the 147 // Controls whether the text is automatically re-colored to be readable on the
140 // background. 148 // background.
141 bool auto_color_readability_enabled_; 149 bool auto_color_readability_enabled_;
142 150
143 DISALLOW_COPY_AND_ASSIGN(StyledLabel); 151 DISALLOW_COPY_AND_ASSIGN(StyledLabel);
144 }; 152 };
145 153
146 } // namespace views 154 } // namespace views
147 155
148 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 156 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_generation_agent.cc ('k') | ui/views/controls/styled_label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698