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

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

Issue 6088008: Remove wstring from l10n_util. Part 7.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/hung_renderer_dialog.h" 5 #include "chrome/browser/hung_renderer_dialog.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 window()->Close(); 260 window()->Close();
261 // Since we're closing, we no longer need this TabContents. 261 // Since we're closing, we no longer need this TabContents.
262 contents_ = NULL; 262 contents_ = NULL;
263 } 263 }
264 } 264 }
265 265
266 /////////////////////////////////////////////////////////////////////////////// 266 ///////////////////////////////////////////////////////////////////////////////
267 // HungRendererDialogView, views::DialogDelegate implementation: 267 // HungRendererDialogView, views::DialogDelegate implementation:
268 268
269 std::wstring HungRendererDialogView::GetWindowTitle() const { 269 std::wstring HungRendererDialogView::GetWindowTitle() const {
270 return l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE); 270 return UTF16ToWide(
271 l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE));
271 } 272 }
272 273
273 void HungRendererDialogView::WindowClosing() { 274 void HungRendererDialogView::WindowClosing() {
274 // We are going to be deleted soon, so make sure our instance is destroyed. 275 // We are going to be deleted soon, so make sure our instance is destroyed.
275 g_instance = NULL; 276 g_instance = NULL;
276 } 277 }
277 278
278 int HungRendererDialogView::GetDialogButtons() const { 279 int HungRendererDialogView::GetDialogButtons() const {
279 // We specifically don't want a CANCEL button here because that code path is 280 // We specifically don't want a CANCEL button here because that code path is
280 // also called when the window is closed by the user clicking the X button in 281 // also called when the window is closed by the user clicking the X button in
281 // the window's titlebar, and also if we call Window::Close. Rather, we want 282 // the window's titlebar, and also if we call Window::Close. Rather, we want
282 // the OK button to wait for responsiveness (and close the dialog) and our 283 // the OK button to wait for responsiveness (and close the dialog) and our
283 // additional button (which we create) to kill the process (which will result 284 // additional button (which we create) to kill the process (which will result
284 // in the dialog being destroyed). 285 // in the dialog being destroyed).
285 return MessageBoxFlags::DIALOGBUTTON_OK; 286 return MessageBoxFlags::DIALOGBUTTON_OK;
286 } 287 }
287 288
288 std::wstring HungRendererDialogView::GetDialogButtonLabel( 289 std::wstring HungRendererDialogView::GetDialogButtonLabel(
289 MessageBoxFlags::DialogButton button) const { 290 MessageBoxFlags::DialogButton button) const {
290 if (button == MessageBoxFlags::DIALOGBUTTON_OK) 291 if (button == MessageBoxFlags::DIALOGBUTTON_OK)
291 return l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); 292 return UTF16ToWide(
293 l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT));
292 return std::wstring(); 294 return std::wstring();
293 } 295 }
294 296
295 views::View* HungRendererDialogView::GetExtraView() { 297 views::View* HungRendererDialogView::GetExtraView() {
296 return kill_button_container_; 298 return kill_button_container_;
297 } 299 }
298 300
299 bool HungRendererDialogView::Accept(bool window_closing) { 301 bool HungRendererDialogView::Accept(bool window_closing) {
300 // Don't do anything if we're being called only because the dialog is being 302 // Don't do anything if we're being called only because the dialog is being
301 // destroyed and we don't supply a Cancel function... 303 // destroyed and we don't supply a Cancel function...
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 339 }
338 340
339 /////////////////////////////////////////////////////////////////////////////// 341 ///////////////////////////////////////////////////////////////////////////////
340 // HungRendererDialogView, private: 342 // HungRendererDialogView, private:
341 343
342 void HungRendererDialogView::Init() { 344 void HungRendererDialogView::Init() {
343 frozen_icon_view_ = new views::ImageView; 345 frozen_icon_view_ = new views::ImageView;
344 frozen_icon_view_->SetImage(frozen_icon_); 346 frozen_icon_view_->SetImage(frozen_icon_);
345 347
346 info_label_ = new views::Label( 348 info_label_ = new views::Label(
347 l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER)); 349 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER)));
348 info_label_->SetMultiLine(true); 350 info_label_->SetMultiLine(true);
349 info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 351 info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
350 352
351 hung_pages_table_model_.reset(new HungPagesTableModel); 353 hung_pages_table_model_.reset(new HungPagesTableModel);
352 std::vector<TableColumn> columns; 354 std::vector<TableColumn> columns;
353 columns.push_back(TableColumn()); 355 columns.push_back(TableColumn());
354 hung_pages_table_ = new views::GroupTableView( 356 hung_pages_table_ = new views::GroupTableView(
355 hung_pages_table_model_.get(), columns, views::ICON_AND_TEXT, true, 357 hung_pages_table_model_.get(), columns, views::ICON_AND_TEXT, true,
356 false, true, false); 358 false, true, false);
357 hung_pages_table_->SetPreferredSize( 359 hung_pages_table_->SetPreferredSize(
(...skipping 22 matching lines...) Expand all
380 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); 382 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
381 383
382 layout->StartRow(0, double_column_set_id); 384 layout->StartRow(0, double_column_set_id);
383 layout->SkipColumns(1); 385 layout->SkipColumns(1);
384 layout->AddView(hung_pages_table_); 386 layout->AddView(hung_pages_table_);
385 387
386 initialized_ = true; 388 initialized_ = true;
387 } 389 }
388 390
389 void HungRendererDialogView::CreateKillButtonView() { 391 void HungRendererDialogView::CreateKillButtonView() {
390 kill_button_ = new views::NativeButton( 392 kill_button_ = new views::NativeButton(this, UTF16ToWide(
391 this, l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_END)); 393 l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END)));
392 394
393 kill_button_container_ = new ButtonContainer; 395 kill_button_container_ = new ButtonContainer;
394 396
395 using views::GridLayout; 397 using views::GridLayout;
396 using views::ColumnSet; 398 using views::ColumnSet;
397 399
398 GridLayout* layout = new GridLayout(kill_button_container_); 400 GridLayout* layout = new GridLayout(kill_button_container_);
399 kill_button_container_->SetLayoutManager(layout); 401 kill_button_container_->SetLayoutManager(layout);
400 402
401 const int single_column_set_id = 0; 403 const int single_column_set_id = 0;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 457 }
456 458
457 // static 459 // static
458 void HideForTabContents(TabContents* contents) { 460 void HideForTabContents(TabContents* contents) {
459 if (!logging::DialogsAreSuppressed() && g_instance) 461 if (!logging::DialogsAreSuppressed() && g_instance)
460 g_instance->EndForTabContents(contents); 462 g_instance->EndForTabContents(contents);
461 } 463 }
462 464
463 } // namespace hung_renderer_dialog 465 } // namespace hung_renderer_dialog
464 466
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698