summaryrefslogtreecommitdiffstats
path: root/chrome/utility/utility_thread.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 00:01:55 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 00:01:55 +0000
commit574c7bb72cdc18bc52b69a10aad1287c85a57c70 (patch)
treeb52524b1ad81c3311603d421af4b3587a22320c8 /chrome/utility/utility_thread.cc
parent3ab6796d3645a13a56a2fc311fc36c66d31089d6 (diff)
downloadchromium_src-574c7bb72cdc18bc52b69a10aad1287c85a57c70.zip
chromium_src-574c7bb72cdc18bc52b69a10aad1287c85a57c70.tar.gz
chromium_src-574c7bb72cdc18bc52b69a10aad1287c85a57c70.tar.bz2
As the first step in an effort to improve robustness of the cloud print proxy, we fetch printer capabilities and defaults in a child process so that printer driver crashes do not crash the entire proxy.
BUG=None TEST=Registration of printers, printer update in Cloud Print Proxy. Review URL: http://codereview.chromium.org/5947002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility/utility_thread.cc')
-rw-r--r--chrome/utility/utility_thread.cc17
1 files changed, 17 insertions, 0 deletions
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();
}
+