diff options
Diffstat (limited to 'chrome/utility')
-rw-r--r-- | chrome/utility/utility_main.cc | 14 | ||||
-rw-r--r-- | chrome/utility/utility_thread.cc | 17 | ||||
-rw-r--r-- | chrome/utility/utility_thread.h | 6 |
3 files changed, 31 insertions, 6 deletions
diff --git a/chrome/utility/utility_main.cc b/chrome/utility/utility_main.cc index 09d0156..0fa6777 100644 --- a/chrome/utility/utility_main.cc +++ b/chrome/utility/utility_main.cc @@ -45,12 +45,14 @@ int UtilityMain(const MainFunctionParams& parameters) { DCHECK(rv) << "Couldn't load PDF plugin"; } - sandbox::TargetServices* target_services = - parameters.sandbox_info_.TargetServices(); - if (!target_services) - return false; - - target_services->LowerToken(); + bool no_sandbox = parameters.command_line_.HasSwitch(switches::kNoSandbox); + if (!no_sandbox) { + sandbox::TargetServices* target_services = + parameters.sandbox_info_.TargetServices(); + if (!target_services) + return false; + target_services->LowerToken(); + } #endif CommandLine* command_line = CommandLine::ForCurrentProcess(); diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index 81e7ff4..baf831f 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -63,6 +63,8 @@ void UtilityThread::OnControlMessageReceived(const IPC::Message& msg) { OnIDBKeysFromValuesAndKeyPath) IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) + IPC_MESSAGE_HANDLER(UtilityMsg_GetPrinterCapsAndDefaults, + OnGetPrinterCapsAndDefaults) IPC_END_MESSAGE_MAP() } @@ -306,7 +308,22 @@ void UtilityThread::OnBatchModeFinished() { ChildProcess::current()->ReleaseProcess(); } +void UtilityThread::OnGetPrinterCapsAndDefaults( + const std::string& printer_name) { + scoped_refptr<printing::PrintBackend> print_backend = + printing::PrintBackend::CreateInstance(NULL); + printing::PrinterCapsAndDefaults printer_info; + if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { + Send(new UtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded(printer_name, + printer_info)); + } else { + Send(new UtilityHostMsg_GetPrinterCapsAndDefaults_Failed(printer_name)); + } + ReleaseProcessIfNeeded(); +} + void UtilityThread::ReleaseProcessIfNeeded() { if (!batch_mode_) ChildProcess::current()->ReleaseProcess(); } + diff --git a/chrome/utility/utility_thread.h b/chrome/utility/utility_thread.h index 36419aa..187f914 100644 --- a/chrome/utility/utility_thread.h +++ b/chrome/utility/utility_thread.h @@ -84,6 +84,12 @@ class UtilityThread : public ChildThread { // IPC to notify batch mode has finished and we should now quit. void OnBatchModeFinished(); + // IPC to get capabilities and defaults for the specified + // printer. Used on Windows to isolate the service process from printer driver + // crashes by executing this in a separate process. This does not run in a + // sandbox. + void OnGetPrinterCapsAndDefaults(const std::string& printer_name); + // Releases the process if we are not (or no longer) in batch mode. void ReleaseProcessIfNeeded(); |