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/win/chrome_select_file_dialog_factory.h" | 5 #include "chrome/browser/win/chrome_select_file_dialog_factory.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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 event_.Signal(); | 110 event_.Signal(); |
111 } | 111 } |
112 | 112 |
113 // Initiates IPC with a new utility process using |client|. Instructs the | 113 // Initiates IPC with a new utility process using |client|. Instructs the |
114 // utility process to call GetOpenFileName with |ofn|. |current_task_runner| | 114 // utility process to call GetOpenFileName with |ofn|. |current_task_runner| |
115 // must be the currently executing task runner. | 115 // must be the currently executing task runner. |
116 void DoInvokeGetOpenFileName( | 116 void DoInvokeGetOpenFileName( |
117 OPENFILENAME* ofn, | 117 OPENFILENAME* ofn, |
118 scoped_refptr<GetOpenFileNameClient> client, | 118 scoped_refptr<GetOpenFileNameClient> client, |
119 const scoped_refptr<base::SequencedTaskRunner>& current_task_runner) { | 119 const scoped_refptr<base::SequencedTaskRunner>& current_task_runner) { |
120 DCHECK(current_task_runner->RunsTasksOnCurrentThread()); | 120 DCHECK(current_task_runner->RunsTasksInCurrentSequence()); |
121 | 121 |
122 base::WeakPtr<content::UtilityProcessHost> utility_process_host( | 122 base::WeakPtr<content::UtilityProcessHost> utility_process_host( |
123 content::UtilityProcessHost::Create(client, current_task_runner) | 123 content::UtilityProcessHost::Create(client, current_task_runner) |
124 ->AsWeakPtr()); | 124 ->AsWeakPtr()); |
125 utility_process_host->SetName(l10n_util::GetStringUTF16( | 125 utility_process_host->SetName(l10n_util::GetStringUTF16( |
126 IDS_UTILITY_PROCESS_FILE_DIALOG_NAME)); | 126 IDS_UTILITY_PROCESS_FILE_DIALOG_NAME)); |
127 utility_process_host->DisableSandbox(); | 127 utility_process_host->DisableSandbox(); |
128 utility_process_host->Send(new ChromeUtilityMsg_GetOpenFileName( | 128 utility_process_host->Send(new ChromeUtilityMsg_GetOpenFileName( |
129 ofn->hwndOwner, | 129 ofn->hwndOwner, |
130 ofn->Flags & ~OFN_ENABLEHOOK, // We can't send a hook function over IPC. | 130 ofn->Flags & ~OFN_ENABLEHOOK, // We can't send a hook function over IPC. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 event_.Signal(); | 240 event_.Signal(); |
241 } | 241 } |
242 | 242 |
243 // Initiates IPC with a new utility process using |client|. Instructs the | 243 // Initiates IPC with a new utility process using |client|. Instructs the |
244 // utility process to call GetSaveFileName with |ofn|. |current_task_runner| | 244 // utility process to call GetSaveFileName with |ofn|. |current_task_runner| |
245 // must be the currently executing task runner. | 245 // must be the currently executing task runner. |
246 void DoInvokeGetSaveFileName( | 246 void DoInvokeGetSaveFileName( |
247 OPENFILENAME* ofn, | 247 OPENFILENAME* ofn, |
248 scoped_refptr<GetSaveFileNameClient> client, | 248 scoped_refptr<GetSaveFileNameClient> client, |
249 const scoped_refptr<base::SequencedTaskRunner>& current_task_runner) { | 249 const scoped_refptr<base::SequencedTaskRunner>& current_task_runner) { |
250 DCHECK(current_task_runner->RunsTasksOnCurrentThread()); | 250 DCHECK(current_task_runner->RunsTasksInCurrentSequence()); |
251 | 251 |
252 base::WeakPtr<content::UtilityProcessHost> utility_process_host( | 252 base::WeakPtr<content::UtilityProcessHost> utility_process_host( |
253 content::UtilityProcessHost::Create(client, current_task_runner) | 253 content::UtilityProcessHost::Create(client, current_task_runner) |
254 ->AsWeakPtr()); | 254 ->AsWeakPtr()); |
255 utility_process_host->SetName(l10n_util::GetStringUTF16( | 255 utility_process_host->SetName(l10n_util::GetStringUTF16( |
256 IDS_UTILITY_PROCESS_FILE_DIALOG_NAME)); | 256 IDS_UTILITY_PROCESS_FILE_DIALOG_NAME)); |
257 utility_process_host->DisableSandbox(); | 257 utility_process_host->DisableSandbox(); |
258 ChromeUtilityMsg_GetSaveFileName_Params params; | 258 ChromeUtilityMsg_GetSaveFileName_Params params; |
259 params.owner = ofn->hwndOwner; | 259 params.owner = ofn->hwndOwner; |
260 // We can't pass the hook function over IPC. | 260 // We can't pass the hook function over IPC. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 ui::SelectFileDialog* ChromeSelectFileDialogFactory::Create( | 314 ui::SelectFileDialog* ChromeSelectFileDialogFactory::Create( |
315 ui::SelectFileDialog::Listener* listener, | 315 ui::SelectFileDialog::Listener* listener, |
316 ui::SelectFilePolicy* policy) { | 316 ui::SelectFilePolicy* policy) { |
317 return ui::CreateWinSelectFileDialog( | 317 return ui::CreateWinSelectFileDialog( |
318 listener, | 318 listener, |
319 policy, | 319 policy, |
320 base::Bind(GetOpenFileNameImpl, blocking_task_runner_), | 320 base::Bind(GetOpenFileNameImpl, blocking_task_runner_), |
321 base::Bind(GetSaveFileNameImpl, blocking_task_runner_)); | 321 base::Bind(GetSaveFileNameImpl, blocking_task_runner_)); |
322 } | 322 } |
OLD | NEW |