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

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

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

Powered by Google App Engine
This is Rietveld 408576698