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

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

Issue 12662033: Show user data dialog earlier on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a browser test as suggested by Scott. Created 7 years, 9 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 "chrome/browser/ui/chrome_select_file_policy.h" 9 #include "chrome/browser/ui/chrome_select_file_policy.h"
10 #include "chrome/browser/ui/user_data_dir_dialog.h" 10 #include "chrome/browser/ui/user_data_dir_dialog.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void* params) { 96 void* params) {
97 user_data_dir_ = path; 97 user_data_dir_ = path;
98 is_blocking_ = false; 98 is_blocking_ = false;
99 } 99 }
100 100
101 void UserDataDirDialogView::FileSelectionCanceled(void* params) { 101 void UserDataDirDialogView::FileSelectionCanceled(void* params) {
102 } 102 }
103 103
104 namespace chrome { 104 namespace chrome {
105 105
106 base::Closure g_custom_callback_for_test;
sky 2013/03/22 23:14:27 Constants like this can not be objects.
hshi1 2013/03/22 23:51:04 Done. (Made it a pointer, and moved to extractor_w
107 void InstallCustomShowUserDataDirDialogCallbackForTest(
108 const base::Closure& callback) {
109 g_custom_callback_for_test = callback;
110 }
111
106 base::FilePath ShowUserDataDirDialog(const base::FilePath& user_data_dir) { 112 base::FilePath ShowUserDataDirDialog(const base::FilePath& user_data_dir) {
113 if (!g_custom_callback_for_test.is_null()) {
114 g_custom_callback_for_test().Run();
115 return base::FilePath();
116 }
107 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 117 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
108 // When the window closes, it will delete itself. 118 // When the window closes, it will delete itself.
109 UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir); 119 UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir);
110 views::Widget::CreateWindow(dialog)->Show(); 120 views::Widget::CreateWindow(dialog)->Show();
111 base::RunLoop run_loop(dialog); 121 base::RunLoop run_loop(dialog);
112 run_loop.Run(); 122 run_loop.Run();
113 return dialog->user_data_dir(); 123 return dialog->user_data_dir();
114 } 124 }
115 125
116 } // namespace chrome 126 } // namespace chrome
OLDNEW
« chrome/browser/chrome_browser_main.cc ('K') | « chrome/browser/ui/user_data_dir_dialog.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698