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

Side by Side Diff: chrome/browser/ui/views/importing_progress_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/views/importing_progress_view.h" 5 #include "chrome/browser/views/importing_progress_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/utf_string_conversions.h"
8 #include "grit/chromium_strings.h" 9 #include "grit/chromium_strings.h"
9 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
10 #include "grit/locale_settings.h" 11 #include "grit/locale_settings.h"
11 #include "views/grid_layout.h" 12 #include "views/grid_layout.h"
12 #include "views/controls/label.h" 13 #include "views/controls/label.h"
13 #include "views/controls/throbber.h" 14 #include "views/controls/throbber.h"
14 #include "views/standard_layout.h" 15 #include "views/standard_layout.h"
15 #include "views/window/window.h" 16 #include "views/window/window.h"
16 17
17 //////////////////////////////////////////////////////////////////////////////// 18 ////////////////////////////////////////////////////////////////////////////////
18 // ImportingProgressView, public: 19 // ImportingProgressView, public:
19 20
20 ImportingProgressView::ImportingProgressView(const std::wstring& source_name, 21 ImportingProgressView::ImportingProgressView(const std::wstring& source_name,
21 int16 items, 22 int16 items,
22 ImporterHost* coordinator, 23 ImporterHost* coordinator,
23 ImportObserver* observer, 24 ImportObserver* observer,
24 HWND parent_window, 25 HWND parent_window,
25 bool bookmarks_import) 26 bool bookmarks_import)
26 : state_bookmarks_(new views::CheckmarkThrobber), 27 : state_bookmarks_(new views::CheckmarkThrobber),
27 state_searches_(new views::CheckmarkThrobber), 28 state_searches_(new views::CheckmarkThrobber),
28 state_passwords_(new views::CheckmarkThrobber), 29 state_passwords_(new views::CheckmarkThrobber),
29 state_history_(new views::CheckmarkThrobber), 30 state_history_(new views::CheckmarkThrobber),
30 state_cookies_(new views::CheckmarkThrobber), 31 state_cookies_(new views::CheckmarkThrobber),
31 label_bookmarks_(new views::Label( 32 label_bookmarks_(new views::Label(UTF16ToWide(
32 l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS))), 33 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS)))),
33 label_searches_(new views::Label( 34 label_searches_(new views::Label(UTF16ToWide(
34 l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_SEARCH))), 35 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_SEARCH)))),
35 label_passwords_(new views::Label( 36 label_passwords_(new views::Label(UTF16ToWide(
36 l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS))), 37 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS)))),
37 label_history_(new views::Label( 38 label_history_(new views::Label(UTF16ToWide(
38 l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_HISTORY))), 39 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_HISTORY)))),
39 label_cookies_(new views::Label( 40 label_cookies_(new views::Label(UTF16ToWide(
40 l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_COOKIES))), 41 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_COOKIES)))),
41 parent_window_(parent_window), 42 parent_window_(parent_window),
42 coordinator_(coordinator), 43 coordinator_(coordinator),
43 import_observer_(observer), 44 import_observer_(observer),
44 items_(items), 45 items_(items),
45 importing_(true), 46 importing_(true),
46 bookmarks_import_(bookmarks_import) { 47 bookmarks_import_(bookmarks_import) {
47 std::wstring info_text = bookmarks_import ? 48 std::wstring info_text = bookmarks_import ?
48 l10n_util::GetString(IDS_IMPORT_BOOKMARKS) : 49 UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_BOOKMARKS)) :
49 l10n_util::GetStringF(IDS_IMPORT_PROGRESS_INFO, source_name); 50 UTF16ToWide(l10n_util::GetStringFUTF16(
51 IDS_IMPORT_PROGRESS_INFO,
52 WideToUTF16(source_name)));
50 label_info_ = new views::Label(info_text); 53 label_info_ = new views::Label(info_text);
51 coordinator_->SetObserver(this); 54 coordinator_->SetObserver(this);
52 label_info_->SetMultiLine(true); 55 label_info_->SetMultiLine(true);
53 label_info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 56 label_info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
54 label_bookmarks_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 57 label_bookmarks_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
55 label_searches_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 58 label_searches_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
56 label_passwords_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 59 label_passwords_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
57 label_history_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 60 label_history_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
58 label_cookies_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 61 label_cookies_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
59 62
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 //////////////////////////////////////////////////////////////////////////////// 184 ////////////////////////////////////////////////////////////////////////////////
182 // ImportingProgressView, views::DialogDelegate implementation: 185 // ImportingProgressView, views::DialogDelegate implementation:
183 186
184 int ImportingProgressView::GetDialogButtons() const { 187 int ImportingProgressView::GetDialogButtons() const {
185 return MessageBoxFlags::DIALOGBUTTON_CANCEL; 188 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
186 } 189 }
187 190
188 std::wstring ImportingProgressView::GetDialogButtonLabel( 191 std::wstring ImportingProgressView::GetDialogButtonLabel(
189 MessageBoxFlags::DialogButton button) const { 192 MessageBoxFlags::DialogButton button) const {
190 DCHECK(button == MessageBoxFlags::DIALOGBUTTON_CANCEL); 193 DCHECK(button == MessageBoxFlags::DIALOGBUTTON_CANCEL);
191 return l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_CANCEL); 194 return UTF16ToWide(
195 l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_CANCEL));
192 } 196 }
193 197
194 bool ImportingProgressView::IsModal() const { 198 bool ImportingProgressView::IsModal() const {
195 return parent_window_ != NULL; 199 return parent_window_ != NULL;
196 } 200 }
197 201
198 std::wstring ImportingProgressView::GetWindowTitle() const { 202 std::wstring ImportingProgressView::GetWindowTitle() const {
199 return l10n_util::GetString(IDS_IMPORT_PROGRESS_TITLE); 203 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_TITLE));
200 } 204 }
201 205
202 bool ImportingProgressView::Cancel() { 206 bool ImportingProgressView::Cancel() {
203 // When the user cancels the import, we need to tell the coordinator to stop 207 // When the user cancels the import, we need to tell the coordinator to stop
204 // importing and return false so that the window lives long enough to receive 208 // importing and return false so that the window lives long enough to receive
205 // ImportEnded, which will close the window. Closing the window results in 209 // ImportEnded, which will close the window. Closing the window results in
206 // another call to this function and at that point we must return true to 210 // another call to this function and at that point we must return true to
207 // allow the window to close. 211 // allow the window to close.
208 if (!importing_) 212 if (!importing_)
209 return true; // We have received ImportEnded, so we can close. 213 return true; // We have received ImportEnded, so we can close.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 views::Window* window = 307 views::Window* window =
304 views::Window::CreateChromeWindow(parent_window, gfx::Rect(), v); 308 views::Window::CreateChromeWindow(parent_window, gfx::Rect(), v);
305 309
306 if (!coordinator->is_headless() && !first_run) 310 if (!coordinator->is_headless() && !first_run)
307 window->Show(); 311 window->Show();
308 312
309 coordinator->StartImportSettings(source_profile, target_profile, items, 313 coordinator->StartImportSettings(source_profile, target_profile, items,
310 new ProfileWriter(target_profile), 314 new ProfileWriter(target_profile),
311 first_run); 315 first_run);
312 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698