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

Side by Side Diff: chrome/browser/ui/views/download/download_in_progress_dialog_view.cc

Issue 1103293004: Use ICU plural syntax in more place (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: recently_closed.js restored per estade Created 5 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/download/download_in_progress_dialog_view.h" 5 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/grit/chromium_strings.h" 10 #include "chrome/grit/chromium_strings.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 DownloadInProgressDialogView::DownloadInProgressDialogView( 32 DownloadInProgressDialogView::DownloadInProgressDialogView(
33 int download_count, 33 int download_count,
34 Browser::DownloadClosePreventionType dialog_type, 34 Browser::DownloadClosePreventionType dialog_type,
35 bool app_modal, 35 bool app_modal,
36 const base::Callback<void(bool)>& callback) 36 const base::Callback<void(bool)>& callback)
37 : app_modal_(app_modal), 37 : app_modal_(app_modal),
38 callback_(callback), 38 callback_(callback),
39 message_box_view_(NULL) { 39 message_box_view_(NULL) {
40 base::string16 explanation_text; 40 // This dialog should have been created within the same thread invocation
41 switch (dialog_type) { 41 // as the original test, so it's never ok to close.
42 case Browser::DOWNLOAD_CLOSE_BROWSER_SHUTDOWN: 42 DCHECK_NE(Browser::DOWNLOAD_CLOSE_OK, dialog_type);
43 if (download_count == 1) { 43 base::string16 explanation_text(l10n_util::GetPluralStringFUTF16(
44 title_text_ = l10n_util::GetStringUTF16( 44 (dialog_type == Browser::DOWNLOAD_CLOSE_BROWSER_SHUTDOWN)
45 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE); 45 ? IDS_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION
46 explanation_text = l10n_util::GetStringUTF16( 46 : IDS_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION,
47 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION); 47 download_count));
48 } else { 48 title_text_ = l10n_util::GetPluralStringFUTF16(
49 title_text_ = l10n_util::GetStringUTF16( 49 IDS_DOWNLOAD_REMOVE_CONFIRM_TITLE, download_count);
50 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE); 50 ok_button_text_ = l10n_util::GetPluralStringFUTF16(
51 explanation_text = l10n_util::GetStringUTF16( 51 IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL, download_count);
52 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION); 52 cancel_button_text_ = l10n_util::GetPluralStringFUTF16(
53 } 53 IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL, download_count);
54 ok_button_text_ = l10n_util::GetStringUTF16(
55 IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
56 break;
57 case Browser::DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE:
58 if (download_count == 1) {
59 title_text_ = l10n_util::GetStringUTF16(
60 IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_TITLE);
61 explanation_text = l10n_util::GetStringUTF16(
62 IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
63 } else {
64 title_text_ = l10n_util::GetStringUTF16(
65 IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_TITLE);
66 explanation_text = l10n_util::GetStringUTF16(
67 IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
68 }
69 ok_button_text_ = l10n_util::GetStringUTF16(
70 IDS_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
71 break;
72 default:
73 // This dialog should have been created within the same thread invocation
74 // as the original test that lead to us, so it should always not be ok
75 // to close.
76 NOTREACHED();
77 }
78 cancel_button_text_ = l10n_util::GetStringUTF16(
79 IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
80 54
81 message_box_view_ = new views::MessageBoxView( 55 message_box_view_ = new views::MessageBoxView(
82 views::MessageBoxView::InitParams(explanation_text)); 56 views::MessageBoxView::InitParams(explanation_text));
83 } 57 }
84 58
85 DownloadInProgressDialogView::~DownloadInProgressDialogView() {} 59 DownloadInProgressDialogView::~DownloadInProgressDialogView() {}
86 60
87 int DownloadInProgressDialogView::GetDefaultDialogButton() const { 61 int DownloadInProgressDialogView::GetDefaultDialogButton() const {
88 return ui::DIALOG_BUTTON_CANCEL; 62 return ui::DIALOG_BUTTON_CANCEL;
89 } 63 }
(...skipping 30 matching lines...) Expand all
120 return message_box_view_->GetWidget(); 94 return message_box_view_->GetWidget();
121 } 95 }
122 96
123 const views::Widget* DownloadInProgressDialogView::GetWidget() const { 97 const views::Widget* DownloadInProgressDialogView::GetWidget() const {
124 return message_box_view_->GetWidget(); 98 return message_box_view_->GetWidget();
125 } 99 }
126 100
127 views::View* DownloadInProgressDialogView::GetContentsView() { 101 views::View* DownloadInProgressDialogView::GetContentsView() {
128 return message_box_view_; 102 return message_box_view_;
129 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc ('k') | chrome/browser/ui/views/frame/global_menu_bar_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698