Index: content/public/browser/utility_process_mojo_client.h |
diff --git a/content/public/browser/utility_process_mojo_client.h b/content/public/browser/utility_process_mojo_client.h |
index cfcb93b953dd1b87f3c8dc4dba6722809db9ac8b..258c3dc2430ff374e93573dbdcae95d43a859a9b 100644 |
--- a/content/public/browser/utility_process_mojo_client.h |
+++ b/content/public/browser/utility_process_mojo_client.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include "base/callback.h" |
+#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/macros.h" |
#include "base/strings/string16.h" |
@@ -42,6 +43,12 @@ class UtilityProcessMojoClient { |
on_error_callback_ = on_error_callback; |
} |
+ // Allows a directory to be opened through the sandbox. |
+ void set_exposed_directory(const base::FilePath& directory) { |
+ DCHECK(!start_called_); |
+ helper_->set_exposed_directory(directory); |
+ } |
+ |
// Disables the sandbox in the utility process. |
void set_disable_sandbox() { |
DCHECK(!start_called_); |
@@ -102,6 +109,10 @@ class UtilityProcessMojoClient { |
mojo_interface_name, base::Passed(&interface_pipe))); |
} |
+ void set_exposed_directory(const base::FilePath& directory) { |
+ exposed_directory_ = directory; |
+ } |
+ |
void set_disable_sandbox() { disable_sandbox_ = true; } |
#if defined(OS_WIN) |
@@ -120,6 +131,9 @@ class UtilityProcessMojoClient { |
utility_host_ = UtilityProcessHost::Create(nullptr, nullptr)->AsWeakPtr(); |
utility_host_->SetName(process_name_); |
+ if (!exposed_directory_.empty()) |
+ utility_host_->SetExposedDir(exposed_directory_); |
+ |
if (disable_sandbox_) |
utility_host_->DisableSandbox(); |
#if defined(OS_WIN) |
@@ -137,6 +151,7 @@ class UtilityProcessMojoClient { |
// Properties of the utility process. |
base::string16 process_name_; |
+ base::FilePath exposed_directory_; |
bool disable_sandbox_ = false; |
#if defined(OS_WIN) |
bool run_elevated_ = false; |