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

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

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 17 matching lines...) Expand all
28 28
29 EchoDialogView::EchoDialogView(EchoDialogListener* listener) 29 EchoDialogView::EchoDialogView(EchoDialogListener* listener)
30 : label_(NULL), 30 : label_(NULL),
31 listener_(listener), 31 listener_(listener),
32 ok_button_label_id_(0), 32 ok_button_label_id_(0),
33 cancel_button_label_id_(0) { 33 cancel_button_label_id_(0) {
34 } 34 }
35 35
36 EchoDialogView::~EchoDialogView() {} 36 EchoDialogView::~EchoDialogView() {}
37 37
38 void EchoDialogView::InitForEnabledEcho(const string16& service_name, 38 void EchoDialogView::InitForEnabledEcho(const base::string16& service_name,
39 const string16& origin) { 39 const base::string16& origin) {
40 ok_button_label_id_ = IDS_OFFERS_CONSENT_INFOBAR_ENABLE_BUTTON; 40 ok_button_label_id_ = IDS_OFFERS_CONSENT_INFOBAR_ENABLE_BUTTON;
41 cancel_button_label_id_ = IDS_OFFERS_CONSENT_INFOBAR_DISABLE_BUTTON; 41 cancel_button_label_id_ = IDS_OFFERS_CONSENT_INFOBAR_DISABLE_BUTTON;
42 42
43 string16 link = 43 base::string16 link =
44 l10n_util::GetStringUTF16(IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE); 44 l10n_util::GetStringUTF16(IDS_OFFERS_CONSENT_INFOBAR_LABEL_LEARN_MORE);
45 45
46 std::vector<size_t> offsets; 46 std::vector<size_t> offsets;
47 string16 text = l10n_util::GetStringFUTF16(IDS_ECHO_CONSENT_DIALOG_TEXT, 47 base::string16 text = l10n_util::GetStringFUTF16(IDS_ECHO_CONSENT_DIALOG_TEXT,
48 service_name, 48 service_name,
49 link, 49 link,
50 &offsets); 50 &offsets);
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 gfx::Range(offsets[0], offsets[0] + service_name.length()), 58 gfx::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(); 62 views::StyledLabel::RangeStyleInfo::CreateForLink();
63 link_style.font_style = gfx::Font::NORMAL; 63 link_style.font_style = gfx::Font::NORMAL;
64 label_->AddStyleRange(gfx::Range(offsets[1], offsets[1] + link.length()), 64 label_->AddStyleRange(gfx::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 base::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 base::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 views::StyledLabel::RangeStyleInfo::CreateForLink();
87 link_style.font_style = gfx::Font::NORMAL; 87 link_style.font_style = gfx::Font::NORMAL;
88 label_->AddStyleRange(gfx::Range(offset, offset + link.length()), link_style); 88 label_->AddStyleRange(gfx::Range(offset, offset + link.length()), link_style);
89 89
90 SetLabelBorderAndBounds(); 90 SetLabelBorderAndBounds();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 listener_ = NULL; 127 listener_ = NULL;
128 } 128 }
129 return true; 129 return true;
130 } 130 }
131 131
132 string16 EchoDialogView::GetDialogButtonLabel(ui::DialogButton button) const { 132 string16 EchoDialogView::GetDialogButtonLabel(ui::DialogButton button) const {
133 if (button == ui::DIALOG_BUTTON_OK && ok_button_label_id_) 133 if (button == ui::DIALOG_BUTTON_OK && ok_button_label_id_)
134 return l10n_util::GetStringUTF16(ok_button_label_id_); 134 return l10n_util::GetStringUTF16(ok_button_label_id_);
135 if (button == ui::DIALOG_BUTTON_CANCEL && cancel_button_label_id_) 135 if (button == ui::DIALOG_BUTTON_CANCEL && cancel_button_label_id_)
136 return l10n_util::GetStringUTF16(cancel_button_label_id_); 136 return l10n_util::GetStringUTF16(cancel_button_label_id_);
137 return string16(); 137 return base::string16();
138 } 138 }
139 139
140 ui::ModalType EchoDialogView::GetModalType() const { 140 ui::ModalType EchoDialogView::GetModalType() const {
141 return ui::MODAL_TYPE_WINDOW; 141 return ui::MODAL_TYPE_WINDOW;
142 } 142 }
143 143
144 bool EchoDialogView::ShouldShowWindowTitle() const { 144 bool EchoDialogView::ShouldShowWindowTitle() const {
145 return false; 145 return false;
146 } 146 }
147 147
(...skipping 24 matching lines...) Expand all
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 | « chrome/browser/chromeos/ui/echo_dialog_view.h ('k') | chrome/browser/chromeos/ui/idle_logout_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698