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

Side by Side Diff: chrome/browser/ui/views/chooser_content_view.cc

Issue 2061193003: Remove "BUBBLE" from chooser related string IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chooser_content_view.h" 5 #include "chrome/browser/ui/views/chooser_content_view.h"
6 6
7 #include "chrome/grit/generated_resources.h" 7 #include "chrome/grit/generated_resources.h"
8 #include "components/chooser_controller/chooser_controller.h" 8 #include "components/chooser_controller/chooser_controller.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/base/models/table_model.h" 10 #include "ui/base/models/table_model.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return std::max(static_cast<int>(chooser_controller_->NumOptions()), 1); 61 return std::max(static_cast<int>(chooser_controller_->NumOptions()), 1);
62 } 62 }
63 63
64 base::string16 ChooserTableModel::GetText(int row, int column_id) { 64 base::string16 ChooserTableModel::GetText(int row, int column_id) {
65 if (!chooser_controller_) 65 if (!chooser_controller_)
66 return base::string16(); 66 return base::string16();
67 67
68 int num_options = static_cast<int>(chooser_controller_->NumOptions()); 68 int num_options = static_cast<int>(chooser_controller_->NumOptions());
69 if (num_options == 0) { 69 if (num_options == 0) {
70 DCHECK_EQ(0, row); 70 DCHECK_EQ(0, row);
71 return l10n_util::GetStringUTF16( 71 return l10n_util::GetStringUTF16(IDS_CHOOSER_NO_DEVICES_FOUND_PROMPT);
72 IDS_CHOOSER_BUBBLE_NO_DEVICES_FOUND_PROMPT);
73 } 72 }
74 73
75 DCHECK_GE(row, 0); 74 DCHECK_GE(row, 0);
76 DCHECK_LT(row, num_options); 75 DCHECK_LT(row, num_options);
77 return chooser_controller_->GetOption(static_cast<size_t>(row)); 76 return chooser_controller_->GetOption(static_cast<size_t>(row));
78 } 77 }
79 78
80 void ChooserTableModel::SetObserver(ui::TableModelObserver* observer) { 79 void ChooserTableModel::SetObserver(ui::TableModelObserver* observer) {
81 observer_ = observer; 80 observer_ = observer;
82 } 81 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 chooser_table_model_->SetObserver(nullptr); 145 chooser_table_model_->SetObserver(nullptr);
147 } 146 }
148 147
149 gfx::Size ChooserContentView::GetPreferredSize() const { 148 gfx::Size ChooserContentView::GetPreferredSize() const {
150 return gfx::Size(kChooserWidth, kChooserHeight); 149 return gfx::Size(kChooserWidth, kChooserHeight);
151 } 150 }
152 151
153 base::string16 ChooserContentView::GetDialogButtonLabel( 152 base::string16 ChooserContentView::GetDialogButtonLabel(
154 ui::DialogButton button) const { 153 ui::DialogButton button) const {
155 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK 154 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK
156 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT 155 ? IDS_CHOOSER_CONNECT_BUTTON_TEXT
157 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); 156 : IDS_CHOOSER_CANCEL_BUTTON_TEXT);
158 } 157 }
159 158
160 bool ChooserContentView::IsDialogButtonEnabled(ui::DialogButton button) const { 159 bool ChooserContentView::IsDialogButtonEnabled(ui::DialogButton button) const {
161 return button != ui::DIALOG_BUTTON_OK || 160 return button != ui::DIALOG_BUTTON_OK ||
162 !table_view_->selection_model().empty(); 161 !table_view_->selection_model().empty();
163 } 162 }
164 163
165 views::StyledLabel* ChooserContentView::CreateFootnoteView( 164 views::StyledLabel* ChooserContentView::CreateFootnoteView(
166 views::StyledLabelListener* listener) const { 165 views::StyledLabelListener* listener) const {
167 base::string16 link = 166 base::string16 link =
168 l10n_util::GetStringUTF16(IDS_CHOOSER_BUBBLE_GET_HELP_LINK_TEXT); 167 l10n_util::GetStringUTF16(IDS_CHOOSER_GET_HELP_LINK_TEXT);
169 size_t offset = 0; 168 size_t offset = 0;
170 base::string16 text = l10n_util::GetStringFUTF16( 169 base::string16 text =
171 IDS_CHOOSER_BUBBLE_FOOTNOTE_TEXT, link, &offset); 170 l10n_util::GetStringFUTF16(IDS_CHOOSER_FOOTNOTE_TEXT, link, &offset);
172 views::StyledLabel* styled_label = new views::StyledLabel(text, listener); 171 views::StyledLabel* styled_label = new views::StyledLabel(text, listener);
173 styled_label->AddStyleRange( 172 styled_label->AddStyleRange(
174 gfx::Range(offset, offset + link.length()), 173 gfx::Range(offset, offset + link.length()),
175 views::StyledLabel::RangeStyleInfo::CreateForLink()); 174 views::StyledLabel::RangeStyleInfo::CreateForLink());
176 return styled_label; 175 return styled_label;
177 } 176 }
178 177
179 void ChooserContentView::Accept() { 178 void ChooserContentView::Accept() {
180 if (chooser_controller_) { 179 if (chooser_controller_) {
181 chooser_controller_->Select(table_view_->selection_model().active()); 180 chooser_controller_->Select(table_view_->selection_model().active());
(...skipping 21 matching lines...) Expand all
203 } 202 }
204 203
205 void ChooserContentView::UpdateTableModel() { 204 void ChooserContentView::UpdateTableModel() {
206 chooser_table_model_->Update(); 205 chooser_table_model_->Update();
207 } 206 }
208 207
209 void ChooserContentView::ChooserControllerDestroying() { 208 void ChooserContentView::ChooserControllerDestroying() {
210 chooser_controller_ = nullptr; 209 chooser_controller_ = nullptr;
211 chooser_table_model_->ChooserControllerDestroying(); 210 chooser_table_model_->ChooserControllerDestroying();
212 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698