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

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

Issue 431343002: Experimentally isolate OpenItemViaShell in a utility process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove deprecated file. 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') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 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/utility/shell_handler_win.h" 5 #include "chrome/utility/shell_handler_win.h"
6 6
7 #include <commdlg.h> 7 #include <commdlg.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/common/chrome_utility_messages.h" 11 #include "chrome/common/chrome_utility_messages.h"
12 #include "content/public/utility/utility_thread.h" 12 #include "content/public/utility/utility_thread.h"
13 #include "ui/base/win/open_file_name_win.h" 13 #include "ui/base/win/open_file_name_win.h"
14 #include "ui/base/win/shell.h"
14 15
15 ShellHandler::ShellHandler() {} 16 ShellHandler::ShellHandler() {}
16 ShellHandler::~ShellHandler() {} 17 ShellHandler::~ShellHandler() {}
17 18
18 bool ShellHandler::OnMessageReceived(const IPC::Message& message) { 19 bool ShellHandler::OnMessageReceived(const IPC::Message& message) {
19 bool handled = true; 20 bool handled = true;
20 IPC_BEGIN_MESSAGE_MAP(ShellHandler, message) 21 IPC_BEGIN_MESSAGE_MAP(ShellHandler, message)
22 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_OpenItemViaShell,
23 OnOpenItemViaShell)
21 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetOpenFileName, 24 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetOpenFileName,
22 OnGetOpenFileName) 25 OnGetOpenFileName)
23 IPC_MESSAGE_UNHANDLED(handled = false) 26 IPC_MESSAGE_UNHANDLED(handled = false)
24 IPC_END_MESSAGE_MAP() 27 IPC_END_MESSAGE_MAP()
25 return handled; 28 return handled;
26 } 29 }
27 30
31 void ShellHandler::OnOpenItemViaShell(const base::FilePath& full_path) {
32 ui::win::OpenItemViaShell(full_path);
palmer 2014/08/12 21:23:57 Is |full_path| tested for sanity, quoted, or trans
erikwright (departed) 2014/08/13 17:27:13 The utility process is not sandboxed. It is invoki
33 }
34
28 void ShellHandler::OnGetOpenFileName( 35 void ShellHandler::OnGetOpenFileName(
29 HWND owner, 36 HWND owner,
30 DWORD flags, 37 DWORD flags,
31 const GetOpenFileNameFilter& filter, 38 const GetOpenFileNameFilter& filter,
32 const base::FilePath& initial_directory, 39 const base::FilePath& initial_directory,
33 const base::FilePath& filename) { 40 const base::FilePath& filename) {
34 ui::win::OpenFileName open_file_name(owner, flags); 41 ui::win::OpenFileName open_file_name(owner, flags);
35 open_file_name.SetInitialSelection(initial_directory, filename); 42 open_file_name.SetInitialSelection(initial_directory, filename);
36 open_file_name.SetFilters(filter); 43 open_file_name.SetFilters(filter);
37 44
38 base::FilePath directory; 45 base::FilePath directory;
39 std::vector<base::FilePath> filenames; 46 std::vector<base::FilePath> filenames;
40 47
41 if (::GetOpenFileName(open_file_name.GetOPENFILENAME())) 48 if (::GetOpenFileName(open_file_name.GetOPENFILENAME()))
42 open_file_name.GetResult(&directory, &filenames); 49 open_file_name.GetResult(&directory, &filenames);
43 50
44 if (filenames.size()) { 51 if (filenames.size()) {
45 content::UtilityThread::Get()->Send( 52 content::UtilityThread::Get()->Send(
46 new ChromeUtilityHostMsg_GetOpenFileName_Result(directory, filenames)); 53 new ChromeUtilityHostMsg_GetOpenFileName_Result(directory, filenames));
47 } else { 54 } else {
48 content::UtilityThread::Get()->Send( 55 content::UtilityThread::Get()->Send(
49 new ChromeUtilityHostMsg_GetOpenFileName_Failed()); 56 new ChromeUtilityHostMsg_GetOpenFileName_Failed());
50 } 57 }
51 } 58 }
OLDNEW
« no previous file with comments | « chrome/utility/shell_handler_win.h ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698