Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: content/common/sandbox_mac.mm

Issue 2686433002: Move SandboxCompiler class into the sandbox library. (Closed)
Patch Set: Try getting rid of sysctl-read Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/sandbox_mac.h ('k') | content/common/sandbox_mac_compiler_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_mac.mm
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index ccfe86710257cc93502372c147b2c2ac4f940e46..2c219956f05a4259140ae8447a2ac359e9a9e2ee 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -36,7 +36,7 @@
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "media/gpu/vt_video_decode_accelerator_mac.h"
-#include "sandbox/mac/seatbelt.h"
+#include "sandbox/mac/sandbox_compiler.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#include "ui/base/layout.h"
#include "ui/gl/init/gl_factory.h"
@@ -118,43 +118,6 @@ NOINLINE void FatalStringQuoteException(const std::string& str) {
} // namespace
-SandboxCompiler::SandboxCompiler(const std::string& profile_str)
- : params_map_(), profile_str_(profile_str) {
-}
-
-SandboxCompiler::~SandboxCompiler() {
-}
-
-bool SandboxCompiler::InsertBooleanParam(const std::string& key, bool value) {
- return params_map_.insert(std::make_pair(key, value ? "TRUE" : "FALSE"))
- .second;
-}
-
-bool SandboxCompiler::InsertStringParam(const std::string& key,
- const std::string& value) {
- return params_map_.insert(std::make_pair(key, value)).second;
-}
-
-bool SandboxCompiler::CompileAndApplyProfile(std::string* error) {
- char* error_internal = nullptr;
- std::vector<const char*> params;
-
- for (const auto& kv : params_map_) {
- params.push_back(kv.first.c_str());
- params.push_back(kv.second.c_str());
- }
- // The parameters array must be null terminated.
- params.push_back(static_cast<const char*>(0));
-
- if (sandbox::Seatbelt::InitWithParams(profile_str_.c_str(), 0, params.data(),
- &error_internal)) {
- error->assign(error_internal);
- sandbox::Seatbelt::FreeError(error_internal);
- return false;
- }
- return true;
-}
-
// static
bool Sandbox::QuotePlainString(const std::string& src_utf8, std::string* dst) {
dst->clear();
@@ -425,7 +388,7 @@ bool Sandbox::EnableSandbox(int sandbox_type,
return false;
}
- SandboxCompiler compiler(sandbox_data);
+ sandbox::SandboxCompiler compiler(sandbox_data);
if (!allowed_dir.empty()) {
// Add the sandbox parameters necessary to access the given directory.
« no previous file with comments | « content/common/sandbox_mac.h ('k') | content/common/sandbox_mac_compiler_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698