summaryrefslogtreecommitdiffstats
path: root/chrome/utility/utility_main.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 00:15:43 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 00:15:43 +0000
commit130954003bdd03f9c3ae563a2ed67466528e71c5 (patch)
treec59200233fd6fdaeec0c6279efa5fdba2493f402 /chrome/utility/utility_main.cc
parent8a871374acb440a7d35a7b6c10840c7a2f712b65 (diff)
downloadchromium_src-130954003bdd03f9c3ae563a2ed67466528e71c5.zip
chromium_src-130954003bdd03f9c3ae563a2ed67466528e71c5.tar.gz
chromium_src-130954003bdd03f9c3ae563a2ed67466528e71c5.tar.bz2
Created a host for running the utility process as a child of the service process. This is used for rendering PDFs to a metafile in a sandbox for the Cloud Print proxy on Windows.
BUG=None TEST=Test Windows Cloud Print proxy Review URL: http://codereview.chromium.org/2917013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility/utility_main.cc')
-rw-r--r--chrome/utility/utility_main.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome/utility/utility_main.cc b/chrome/utility/utility_main.cc
index a568566..09d0156 100644
--- a/chrome/utility/utility_main.cc
+++ b/chrome/utility/utility_main.cc
@@ -6,10 +6,13 @@
#include "app/hi_res_timer_manager.h"
#include "app/system_monitor.h"
#include "base/command_line.h"
+#include "base/file_util.h"
#include "base/message_loop.h"
+#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/logging_chrome.h"
@@ -19,7 +22,7 @@
#if defined(OS_WIN)
#include "chrome/common/sandbox_init_wrapper.h"
#include "sandbox/src/sandbox.h"
-#endif
+#endif // defined(OS_WIN)
// Mainline routine for running as the utility process.
int UtilityMain(const MainFunctionParams& parameters) {
@@ -33,6 +36,15 @@ int UtilityMain(const MainFunctionParams& parameters) {
ChildProcess utility_process;
utility_process.set_main_thread(new UtilityThread());
#if defined(OS_WIN)
+ // Load the pdf plugin before the sandbox is turned on. This is for Windows
+ // only because we need this DLL only on Windows.
+ FilePath pdf;
+ if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
+ file_util::PathExists(pdf)) {
+ bool rv = !!LoadLibrary(pdf.value().c_str());
+ DCHECK(rv) << "Couldn't load PDF plugin";
+ }
+
sandbox::TargetServices* target_services =
parameters.sandbox_info_.TargetServices();
if (!target_services)