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

Side by Side Diff: chrome/utility/shell_handler_win.cc

Issue 419523006: Experimentally isolate GetOpenFileName in a utility process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 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
« no previous file with comments | « chrome/utility/shell_handler_win.h ('k') | ui/base/win/open_file_name_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/utility/shell_handler_win.h"
6
7 #include <commdlg.h>
8
9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/common/chrome_utility_messages.h"
12 #include "content/public/utility/utility_thread.h"
13 #include "ui/base/win/open_file_name_win.h"
14
15 ShellHandler::ShellHandler() {}
16 ShellHandler::~ShellHandler() {}
17
18 bool ShellHandler::OnMessageReceived(const IPC::Message& message) {
19 bool handled = true;
20 IPC_BEGIN_MESSAGE_MAP(ShellHandler, message)
21 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetOpenFileName,
22 OnGetOpenFileName)
23 IPC_MESSAGE_UNHANDLED(handled = false)
24 IPC_END_MESSAGE_MAP()
25 return handled;
26 }
27
28 void ShellHandler::OnGetOpenFileName(
29 HWND owner,
30 DWORD flags,
31 const GetOpenFileNameFilter& filter,
32 const base::FilePath& initial_directory,
33 const base::FilePath& filename) {
34 ui::win::OpenFileName open_file_name(owner, flags);
35 open_file_name.SetInitialSelection(initial_directory, filename);
36 open_file_name.SetFilters(filter);
37
38 base::FilePath directory;
39 std::vector<base::FilePath> filenames;
40
41 if (::GetOpenFileName(open_file_name.GetOPENFILENAME()))
42 open_file_name.GetResult(&directory, &filenames);
43
44 if (filenames.size()) {
45 content::UtilityThread::Get()->Send(
46 new ChromeUtilityHostMsg_GetOpenFileName_Result(directory, filenames));
47 } else {
48 content::UtilityThread::Get()->Send(
49 new ChromeUtilityHostMsg_GetOpenFileName_Failed());
50 }
51 }
OLDNEW
« no previous file with comments | « chrome/utility/shell_handler_win.h ('k') | ui/base/win/open_file_name_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698