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

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

Issue 10820034: Remove redirection header and add "ui::" before all SelectFileDialog usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reuploading for different try run. Created 8 years, 4 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) 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/user_data_dir_dialog_view.h" 5 #include "chrome/browser/ui/views/user_data_dir_dialog_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/chrome_select_file_policy.h" 10 #include "chrome/browser/ui/chrome_select_file_policy.h"
11 #include "chrome/browser/ui/user_data_dir_dialog.h" 11 #include "chrome/browser/ui/user_data_dir_dialog.h"
12 #include "grit/chromium_strings.h" 12 #include "grit/chromium_strings.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/views/controls/message_box_view.h" 15 #include "ui/views/controls/message_box_view.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 UserDataDirDialogView::UserDataDirDialogView(const FilePath& user_data_dir) 18 UserDataDirDialogView::UserDataDirDialogView(const FilePath& user_data_dir)
19 : ALLOW_THIS_IN_INITIALIZER_LIST( 19 : ALLOW_THIS_IN_INITIALIZER_LIST(
20 select_file_dialog_(SelectFileDialog::Create( 20 select_file_dialog_(ui::SelectFileDialog::Create(
21 this, new ChromeSelectFilePolicy(NULL)))), 21 this, new ChromeSelectFilePolicy(NULL)))),
22 is_blocking_(true) { 22 is_blocking_(true) {
23 const int kDialogWidth = 400; 23 const int kDialogWidth = 400;
24 views::MessageBoxView::InitParams params( 24 views::MessageBoxView::InitParams params(
25 l10n_util::GetStringFUTF16(IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, 25 l10n_util::GetStringFUTF16(IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY,
26 user_data_dir.LossyDisplayName())); 26 user_data_dir.LossyDisplayName()));
27 params.message_width = kDialogWidth; 27 params.message_width = kDialogWidth;
28 message_box_view_ = new views::MessageBoxView(params); 28 message_box_view_ = new views::MessageBoxView(params);
29 } 29 }
30 30
31 UserDataDirDialogView::~UserDataDirDialogView() { 31 UserDataDirDialogView::~UserDataDirDialogView() {
(...skipping 22 matching lines...) Expand all
54 void UserDataDirDialogView::DeleteDelegate() { 54 void UserDataDirDialogView::DeleteDelegate() {
55 delete this; 55 delete this;
56 } 56 }
57 57
58 bool UserDataDirDialogView::Accept() { 58 bool UserDataDirDialogView::Accept() {
59 // Directory picker 59 // Directory picker
60 std::wstring dialog_title = UTF16ToWide(l10n_util::GetStringUTF16( 60 std::wstring dialog_title = UTF16ToWide(l10n_util::GetStringUTF16(
61 IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON)); 61 IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON));
62 HWND owning_hwnd = 62 HWND owning_hwnd =
63 GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT); 63 GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT);
64 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER, 64 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_FOLDER,
65 dialog_title, FilePath(), NULL, 0, 65 dialog_title, FilePath(), NULL, 0,
66 FilePath::StringType(), owning_hwnd, NULL); 66 FilePath::StringType(), owning_hwnd, NULL);
67 return false; 67 return false;
68 } 68 }
69 69
70 bool UserDataDirDialogView::Cancel() { 70 bool UserDataDirDialogView::Cancel() {
71 is_blocking_ = false; 71 is_blocking_ = false;
72 return true; 72 return true;
73 } 73 }
74 74
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 106 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
107 // When the window closes, it will delete itself. 107 // When the window closes, it will delete itself.
108 UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir); 108 UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir);
109 views::Widget::CreateWindow(dialog)->Show(); 109 views::Widget::CreateWindow(dialog)->Show();
110 base::RunLoop run_loop(dialog); 110 base::RunLoop run_loop(dialog);
111 run_loop.Run(); 111 run_loop.Run();
112 return dialog->user_data_dir(); 112 return dialog->user_data_dir();
113 } 113 }
114 114
115 } // namespace chrome 115 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/user_data_dir_dialog_view.h ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698