OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/ui/views/user_data_dir_dialog.h" | 7 #include "chrome/browser/ui/views/user_data_dir_dialog.h" |
8 #include "grit/chromium_strings.h" | 8 #include "grit/chromium_strings.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 MessageLoopForUI::current()->Run(dlg); | 21 MessageLoopForUI::current()->Run(dlg); |
22 return dlg->user_data_dir(); | 22 return dlg->user_data_dir(); |
23 } | 23 } |
24 | 24 |
25 UserDataDirDialog::UserDataDirDialog(const FilePath& user_data_dir) | 25 UserDataDirDialog::UserDataDirDialog(const FilePath& user_data_dir) |
26 : ALLOW_THIS_IN_INITIALIZER_LIST( | 26 : ALLOW_THIS_IN_INITIALIZER_LIST( |
27 select_file_dialog_(SelectFileDialog::Create(this))), | 27 select_file_dialog_(SelectFileDialog::Create(this))), |
28 is_blocking_(true) { | 28 is_blocking_(true) { |
29 std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16( | 29 std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16( |
30 IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, | 30 IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, |
31 WideToUTF16Hack(user_data_dir.ToWStringHack()))); | 31 user_data_dir.LossyDisplayName())); |
32 const int kDialogWidth = 400; | 32 const int kDialogWidth = 400; |
33 message_box_view_ = new MessageBoxView( | 33 message_box_view_ = new MessageBoxView( |
34 ui::MessageBoxFlags::kIsConfirmMessageBox, | 34 ui::MessageBoxFlags::kIsConfirmMessageBox, |
35 message_text.c_str(), std::wstring(), kDialogWidth); | 35 message_text.c_str(), std::wstring(), kDialogWidth); |
36 | 36 |
37 views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show(); | 37 views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show(); |
38 } | 38 } |
39 | 39 |
40 UserDataDirDialog::~UserDataDirDialog() { | 40 UserDataDirDialog::~UserDataDirDialog() { |
41 select_file_dialog_->ListenerDestroyed(); | 41 select_file_dialog_->ListenerDestroyed(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void UserDataDirDialog::FileSelected(const FilePath& path, | 97 void UserDataDirDialog::FileSelected(const FilePath& path, |
98 int index, void* params) { | 98 int index, void* params) { |
99 user_data_dir_ = path; | 99 user_data_dir_ = path; |
100 is_blocking_ = false; | 100 is_blocking_ = false; |
101 } | 101 } |
102 | 102 |
103 void UserDataDirDialog::FileSelectionCanceled(void* params) { | 103 void UserDataDirDialog::FileSelectionCanceled(void* params) { |
104 } | 104 } |
OLD | NEW |