OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_select_file_dialog_factory_win.h" | 5 #include "chrome/browser/chrome_select_file_dialog_factory_win.h" |
6 | 6 |
7 #include <Windows.h> | 7 #include <Windows.h> |
8 #include <commdlg.h> | 8 #include <commdlg.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const std::vector<base::FilePath>& filenames); | 61 const std::vector<base::FilePath>& filenames); |
62 void OnFailure(); | 62 void OnFailure(); |
63 | 63 |
64 base::FilePath directory_; | 64 base::FilePath directory_; |
65 std::vector<base::FilePath> filenames_; | 65 std::vector<base::FilePath> filenames_; |
66 base::WaitableEvent event_; | 66 base::WaitableEvent event_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(GetOpenFileNameClient); | 68 DISALLOW_COPY_AND_ASSIGN(GetOpenFileNameClient); |
69 }; | 69 }; |
70 | 70 |
71 GetOpenFileNameClient::GetOpenFileNameClient() : event_(true, false) { | 71 GetOpenFileNameClient::GetOpenFileNameClient() |
72 } | 72 : event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 73 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
73 | 74 |
74 void GetOpenFileNameClient::WaitForCompletion() { | 75 void GetOpenFileNameClient::WaitForCompletion() { |
75 event_.Wait(); | 76 event_.Wait(); |
76 } | 77 } |
77 | 78 |
78 void GetOpenFileNameClient::OnProcessCrashed(int exit_code) { | 79 void GetOpenFileNameClient::OnProcessCrashed(int exit_code) { |
79 event_.Signal(); | 80 event_.Signal(); |
80 } | 81 } |
81 | 82 |
82 void GetOpenFileNameClient::OnProcessLaunchFailed(int error_code) { | 83 void GetOpenFileNameClient::OnProcessLaunchFailed(int error_code) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void OnFailure(); | 192 void OnFailure(); |
192 | 193 |
193 base::FilePath path_; | 194 base::FilePath path_; |
194 int one_based_filter_index_; | 195 int one_based_filter_index_; |
195 base::WaitableEvent event_; | 196 base::WaitableEvent event_; |
196 | 197 |
197 DISALLOW_COPY_AND_ASSIGN(GetSaveFileNameClient); | 198 DISALLOW_COPY_AND_ASSIGN(GetSaveFileNameClient); |
198 }; | 199 }; |
199 | 200 |
200 GetSaveFileNameClient::GetSaveFileNameClient() | 201 GetSaveFileNameClient::GetSaveFileNameClient() |
201 : one_based_filter_index_(0), event_(true, false) { | 202 : one_based_filter_index_(0), |
202 } | 203 event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 204 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
203 | 205 |
204 void GetSaveFileNameClient::WaitForCompletion() { | 206 void GetSaveFileNameClient::WaitForCompletion() { |
205 event_.Wait(); | 207 event_.Wait(); |
206 } | 208 } |
207 | 209 |
208 void GetSaveFileNameClient::OnProcessCrashed(int exit_code) { | 210 void GetSaveFileNameClient::OnProcessCrashed(int exit_code) { |
209 event_.Signal(); | 211 event_.Signal(); |
210 } | 212 } |
211 | 213 |
212 void GetSaveFileNameClient::OnProcessLaunchFailed(int error_code) { | 214 void GetSaveFileNameClient::OnProcessLaunchFailed(int error_code) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 313 |
312 ui::SelectFileDialog* ChromeSelectFileDialogFactory::Create( | 314 ui::SelectFileDialog* ChromeSelectFileDialogFactory::Create( |
313 ui::SelectFileDialog::Listener* listener, | 315 ui::SelectFileDialog::Listener* listener, |
314 ui::SelectFilePolicy* policy) { | 316 ui::SelectFilePolicy* policy) { |
315 return ui::CreateWinSelectFileDialog( | 317 return ui::CreateWinSelectFileDialog( |
316 listener, | 318 listener, |
317 policy, | 319 policy, |
318 base::Bind(GetOpenFileNameImpl, blocking_task_runner_), | 320 base::Bind(GetOpenFileNameImpl, blocking_task_runner_), |
319 base::Bind(GetSaveFileNameImpl, blocking_task_runner_)); | 321 base::Bind(GetSaveFileNameImpl, blocking_task_runner_)); |
320 } | 322 } |
OLD | NEW |