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

Side by Side Diff: chrome/browser/chromeos/ui/echo_dialog_view.cc

Issue 17756003: Colors in views::StyledLabel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | ui/views/controls/styled_label.h » ('j') | ui/views/controls/styled_label.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/chromeos/ui/echo_dialog_view.h" 5 #include "chrome/browser/chromeos/ui/echo_dialog_view.h"
6 6
7 #include "chrome/browser/chromeos/ui/echo_dialog_listener.h" 7 #include "chrome/browser/chromeos/ui/echo_dialog_listener.h"
8 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/gfx/font.h" 10 #include "ui/gfx/font.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 label_ = new views::StyledLabel(text, this); 52 label_ = new views::StyledLabel(text, this);
53 53
54 views::StyledLabel::RangeStyleInfo service_name_style; 54 views::StyledLabel::RangeStyleInfo service_name_style;
55 service_name_style.font_style = gfx::Font::UNDERLINE; 55 service_name_style.font_style = gfx::Font::UNDERLINE;
56 service_name_style.tooltip = origin; 56 service_name_style.tooltip = origin;
57 label_->AddStyleRange( 57 label_->AddStyleRange(
58 ui::Range(offsets[0], offsets[0] + service_name.length()), 58 ui::Range(offsets[0], offsets[0] + service_name.length()),
59 service_name_style); 59 service_name_style);
60 60
61 views::StyledLabel::RangeStyleInfo link_style; 61 views::StyledLabel::RangeStyleInfo link_style =
62 views::StyledLabel::RangeStyleInfo::CreateForLink();
Roger Tawa OOO till Jul 10th 2013/06/26 15:16:29 This changes |disable_line_wrapping| from false to
fdoray 2013/06/26 17:06:38 I think it's OK. We don't want a line wrap in the
Roger Tawa OOO till Jul 10th 2013/07/02 14:45:29 OK. This seems more generic than just the "learn
62 link_style.font_style = gfx::Font::NORMAL; 63 link_style.font_style = gfx::Font::NORMAL;
63 link_style.is_link = true;
64 label_->AddStyleRange(ui::Range(offsets[1], offsets[1] + link.length()), 64 label_->AddStyleRange(ui::Range(offsets[1], offsets[1] + link.length()),
65 link_style); 65 link_style);
66 66
67 SetLabelBorderAndBounds(); 67 SetLabelBorderAndBounds();
68 68
69 AddChildView(label_); 69 AddChildView(label_);
70 } 70 }
71 71
72 void EchoDialogView::InitForDisabledEcho() { 72 void EchoDialogView::InitForDisabledEcho() {
73 ok_button_label_id_ = 0; 73 ok_button_label_id_ = 0;
74 cancel_button_label_id_ = IDS_ECHO_CONSENT_DISMISS_BUTTON; 74 cancel_button_label_id_ = IDS_ECHO_CONSENT_DISMISS_BUTTON;
75 75
76 string16 link = 76 string16 link =
77 l10n_util::GetStringUTF16(IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE); 77 l10n_util::GetStringUTF16(IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE);
78 78
79 size_t offset; 79 size_t offset;
80 string16 text = l10n_util::GetStringFUTF16( 80 string16 text = l10n_util::GetStringFUTF16(
81 IDS_ECHO_DISABLED_CONSENT_DIALOG_TEXT, link, &offset); 81 IDS_ECHO_DISABLED_CONSENT_DIALOG_TEXT, link, &offset);
82 82
83 label_ = new views::StyledLabel(text, this); 83 label_ = new views::StyledLabel(text, this);
84 84
85 views::StyledLabel::RangeStyleInfo link_style; 85 views::StyledLabel::RangeStyleInfo link_style =
86 views::StyledLabel::RangeStyleInfo::CreateForLink();
86 link_style.font_style = gfx::Font::NORMAL; 87 link_style.font_style = gfx::Font::NORMAL;
87 link_style.is_link = true;
88 label_->AddStyleRange(ui::Range(offset, offset + link.length()), link_style); 88 label_->AddStyleRange(ui::Range(offset, offset + link.length()), link_style);
89 89
90 SetLabelBorderAndBounds(); 90 SetLabelBorderAndBounds();
91 91
92 AddChildView(label_); 92 AddChildView(label_);
93 } 93 }
94 94
95 void EchoDialogView::Show(gfx::NativeWindow parent) { 95 void EchoDialogView::Show(gfx::NativeWindow parent) {
96 DCHECK(cancel_button_label_id_); 96 DCHECK(cancel_button_label_id_);
97 97
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 kDialogLabelBottomInset, 172 kDialogLabelBottomInset,
173 kDialogLabelRightInset)); 173 kDialogLabelRightInset));
174 174
175 label_->SetBounds(label_->x(), 175 label_->SetBounds(label_->x(),
176 label_->y(), 176 label_->y(),
177 kDialogLabelPreferredWidth, 177 kDialogLabelPreferredWidth,
178 label_->GetHeightForWidth(kDialogLabelPreferredWidth)); 178 label_->GetHeightForWidth(kDialogLabelPreferredWidth));
179 } 179 }
180 180
181 } // namespace chromeos 181 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/styled_label.h » ('j') | ui/views/controls/styled_label.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698