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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_process_launcher_win.cc

Issue 2817383002: On windows call a "Native messaging host" with /D (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « AUTHORS ('k') | no next file » | 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) 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/extensions/api/messaging/native_process_launcher.h" 5 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (comspec_length == 0) { 139 if (comspec_length == 0) {
140 LOG(ERROR) << "COMSPEC is not set"; 140 LOG(ERROR) << "COMSPEC is not set";
141 return false; 141 return false;
142 } 142 }
143 std::unique_ptr<wchar_t[]> comspec(new wchar_t[comspec_length]); 143 std::unique_ptr<wchar_t[]> comspec(new wchar_t[comspec_length]);
144 ::GetEnvironmentVariable(L"COMSPEC", comspec.get(), comspec_length); 144 ::GetEnvironmentVariable(L"COMSPEC", comspec.get(), comspec_length);
145 145
146 base::string16 command_line_string = command_line.GetCommandLineString(); 146 base::string16 command_line_string = command_line.GetCommandLineString();
147 147
148 base::string16 command = base::StringPrintf( 148 base::string16 command = base::StringPrintf(
149 L"%ls /c %ls < %ls > %ls", comspec.get(), command_line_string.c_str(), 149 L"%ls /d /c %ls < %ls > %ls", comspec.get(), command_line_string.c_str(),
150 in_pipe_name.c_str(), out_pipe_name.c_str()); 150 in_pipe_name.c_str(), out_pipe_name.c_str());
151 151
152 base::LaunchOptions options; 152 base::LaunchOptions options;
153 options.start_hidden = true; 153 options.start_hidden = true;
154 options.current_directory = command_line.GetProgram().DirName(); 154 options.current_directory = command_line.GetProgram().DirName();
155 base::Process cmd_process = base::LaunchProcess(command, options); 155 base::Process cmd_process = base::LaunchProcess(command, options);
156 if (!cmd_process.IsValid()) { 156 if (!cmd_process.IsValid()) {
157 LOG(ERROR) << "Error launching process " 157 LOG(ERROR) << "Error launching process "
158 << command_line.GetProgram().MaybeAsASCII(); 158 << command_line.GetProgram().MaybeAsASCII();
159 return false; 159 return false;
(...skipping 11 matching lines...) Expand all
171 } 171 }
172 172
173 *process = std::move(cmd_process); 173 *process = std::move(cmd_process);
174 *read_file = base::File::CreateForAsyncHandle(stdout_pipe.Take()); 174 *read_file = base::File::CreateForAsyncHandle(stdout_pipe.Take());
175 *write_file = base::File::CreateForAsyncHandle(stdin_pipe.Take()); 175 *write_file = base::File::CreateForAsyncHandle(stdin_pipe.Take());
176 176
177 return true; 177 return true;
178 } 178 }
179 179
180 } // namespace extensions 180 } // namespace extensions
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698