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

Side by Side Diff: chrome/browser/ui/views/update_recommended_message_box.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/views/update_recommended_message_box.h" 5 #include "chrome/browser/views/update_recommended_message_box.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h" 8 #include "app/message_box_flags.h"
9 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/views/window.h" 13 #include "chrome/browser/views/window.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "views/controls/message_box_view.h" 17 #include "views/controls/message_box_view.h"
17 #include "views/window/window.h" 18 #include "views/window/window.h"
18 19
(...skipping 29 matching lines...) Expand all
48 int UpdateRecommendedMessageBox::GetDialogButtons() const { 49 int UpdateRecommendedMessageBox::GetDialogButtons() const {
49 return MessageBoxFlags::DIALOGBUTTON_OK | 50 return MessageBoxFlags::DIALOGBUTTON_OK |
50 MessageBoxFlags::DIALOGBUTTON_CANCEL; 51 MessageBoxFlags::DIALOGBUTTON_CANCEL;
51 } 52 }
52 53
53 std::wstring UpdateRecommendedMessageBox::GetDialogButtonLabel( 54 std::wstring UpdateRecommendedMessageBox::GetDialogButtonLabel(
54 MessageBoxFlags::DialogButton button) const { 55 MessageBoxFlags::DialogButton button) const {
55 DCHECK(button == MessageBoxFlags::DIALOGBUTTON_OK || 56 DCHECK(button == MessageBoxFlags::DIALOGBUTTON_OK ||
56 button == MessageBoxFlags::DIALOGBUTTON_CANCEL); 57 button == MessageBoxFlags::DIALOGBUTTON_CANCEL);
57 return button == MessageBoxFlags::DIALOGBUTTON_OK ? 58 return button == MessageBoxFlags::DIALOGBUTTON_OK ?
58 l10n_util::GetString(IDS_RESTART_AND_UPDATE) : 59 UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE)) :
59 l10n_util::GetString(IDS_NOT_NOW); 60 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW));
60 } 61 }
61 62
62 std::wstring UpdateRecommendedMessageBox::GetWindowTitle() const { 63 std::wstring UpdateRecommendedMessageBox::GetWindowTitle() const {
63 return l10n_util::GetString(IDS_PRODUCT_NAME); 64 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
64 } 65 }
65 66
66 void UpdateRecommendedMessageBox::DeleteDelegate() { 67 void UpdateRecommendedMessageBox::DeleteDelegate() {
67 delete this; 68 delete this;
68 } 69 }
69 70
70 bool UpdateRecommendedMessageBox::IsModal() const { 71 bool UpdateRecommendedMessageBox::IsModal() const {
71 return true; 72 return true;
72 } 73 }
73 74
74 views::View* UpdateRecommendedMessageBox::GetContentsView() { 75 views::View* UpdateRecommendedMessageBox::GetContentsView() {
75 return message_box_view_; 76 return message_box_view_;
76 } 77 }
77 78
78 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
79 // UpdateRecommendedMessageBox, private: 80 // UpdateRecommendedMessageBox, private:
80 81
81 UpdateRecommendedMessageBox::UpdateRecommendedMessageBox( 82 UpdateRecommendedMessageBox::UpdateRecommendedMessageBox(
82 gfx::NativeWindow parent_window) { 83 gfx::NativeWindow parent_window) {
83 const int kDialogWidth = 400; 84 const int kDialogWidth = 400;
84 #if defined(OS_CHROMEOS) 85 #if defined(OS_CHROMEOS)
85 const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_OS_NAME); 86 const int kProductNameId = IDS_PRODUCT_OS_NAME;
86 #else 87 #else
87 const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_NAME); 88 const int kProductNameId = IDS_PRODUCT_NAME;
88 #endif 89 #endif
90 const string16 product_name = l10n_util::GetStringUTF16(kProductNameId);
89 // Also deleted when the window closes. 91 // Also deleted when the window closes.
90 message_box_view_ = new MessageBoxView( 92 message_box_view_ = new MessageBoxView(
91 MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton, 93 MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton,
92 l10n_util::GetStringF(IDS_UPDATE_RECOMMENDED, product_name), 94 UTF16ToWide(l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED,
95 product_name)),
93 std::wstring(), 96 std::wstring(),
94 kDialogWidth); 97 kDialogWidth);
95 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show(); 98 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show();
96 } 99 }
97 100
98 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() { 101 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() {
99 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698