OLD | NEW |
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 "cloud_print/virtual_driver/win/port_monitor/port_monitor.h" | 5 #include "cloud_print/virtual_driver/win/port_monitor/port_monitor.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <lmcons.h> | 8 #include <lmcons.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return false; | 211 return false; |
212 } | 212 } |
213 base::win::ScopedHandle primary_token_scoped(token); | 213 base::win::ScopedHandle primary_token_scoped(token); |
214 | 214 |
215 base::FilePath chrome_path = GetChromeExePath(); | 215 base::FilePath chrome_path = GetChromeExePath(); |
216 if (chrome_path.empty()) { | 216 if (chrome_path.empty()) { |
217 LOG(ERROR) << "Unable to get chrome exe path."; | 217 LOG(ERROR) << "Unable to get chrome exe path."; |
218 return false; | 218 return false; |
219 } | 219 } |
220 | 220 |
221 CommandLine command_line(chrome_path); | 221 base::CommandLine command_line(chrome_path); |
222 | 222 |
223 base::FilePath chrome_profile = GetChromeProfilePath(); | 223 base::FilePath chrome_profile = GetChromeProfilePath(); |
224 if (!chrome_profile.empty()) | 224 if (!chrome_profile.empty()) |
225 command_line.AppendSwitchPath(switches::kUserDataDir, chrome_profile); | 225 command_line.AppendSwitchPath(switches::kUserDataDir, chrome_profile); |
226 | 226 |
227 command_line.AppendSwitchPath(switches::kCloudPrintFile, xps_path); | 227 command_line.AppendSwitchPath(switches::kCloudPrintFile, xps_path); |
228 command_line.AppendSwitchNative(switches::kCloudPrintFileType, kXpsMimeType); | 228 command_line.AppendSwitchNative(switches::kCloudPrintFileType, kXpsMimeType); |
229 command_line.AppendSwitchNative(switches::kCloudPrintJobTitle, job_title); | 229 command_line.AppendSwitchNative(switches::kCloudPrintJobTitle, job_title); |
230 base::LaunchOptions options; | 230 base::LaunchOptions options; |
231 options.as_user = primary_token_scoped.Get(); | 231 options.as_user = primary_token_scoped.Get(); |
(...skipping 11 matching lines...) Expand all Loading... |
243 HANDLE token = NULL; | 243 HANDLE token = NULL; |
244 if (!GetUserToken(&token)) { | 244 if (!GetUserToken(&token)) { |
245 LOG(ERROR) << "Unable to get user token."; | 245 LOG(ERROR) << "Unable to get user token."; |
246 return; | 246 return; |
247 } | 247 } |
248 base::win::ScopedHandle token_scoped(token); | 248 base::win::ScopedHandle token_scoped(token); |
249 | 249 |
250 base::FilePath ie_path; | 250 base::FilePath ie_path; |
251 PathService::Get(base::DIR_PROGRAM_FILESX86, &ie_path); | 251 PathService::Get(base::DIR_PROGRAM_FILESX86, &ie_path); |
252 ie_path = ie_path.Append(kIePath); | 252 ie_path = ie_path.Append(kIePath); |
253 CommandLine command_line(ie_path); | 253 base::CommandLine command_line(ie_path); |
254 command_line.AppendArg(kChromeInstallUrl); | 254 command_line.AppendArg(kChromeInstallUrl); |
255 | 255 |
256 base::LaunchOptions options; | 256 base::LaunchOptions options; |
257 options.as_user = token_scoped.Get(); | 257 options.as_user = token_scoped.Get(); |
258 base::LaunchProcess(command_line, options, NULL); | 258 base::LaunchProcess(command_line, options, NULL); |
259 } | 259 } |
260 | 260 |
261 // Returns false if the print job is being run in a context | 261 // Returns false if the print job is being run in a context |
262 // that shouldn't be launching Chrome. | 262 // that shouldn't be launching Chrome. |
263 bool ValidateCurrentUser() { | 263 bool ValidateCurrentUser() { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 // Single spooler.exe handles verbose users. | 621 // Single spooler.exe handles verbose users. |
622 PathService::DisableCache(); | 622 PathService::DisableCache(); |
623 } | 623 } |
624 return &cloud_print::g_monitor_2; | 624 return &cloud_print::g_monitor_2; |
625 } | 625 } |
626 | 626 |
627 MONITORUI* WINAPI InitializePrintMonitorUI(void) { | 627 MONITORUI* WINAPI InitializePrintMonitorUI(void) { |
628 return &cloud_print::g_monitor_ui; | 628 return &cloud_print::g_monitor_ui; |
629 } | 629 } |
630 | 630 |
OLD | NEW |