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

Unified Diff: sandbox/mac/seatbelt.cc

Issue 1855303003: Wrap deprecated sandbox functions in C++ class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« sandbox/mac/seatbelt.h ('K') | « sandbox/mac/seatbelt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/mac/seatbelt.cc
diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9daf1a09f1dd6d95c6cd47abf81ebe9d17c36f51
--- /dev/null
+++ b/sandbox/mac/seatbelt.cc
@@ -0,0 +1,42 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sandbox/mac/seatbelt.h"
+
+extern "C" {
+#include <sandbox.h>
+
+int sandbox_init_with_parameters(const char* profile,
+ uint64_t flags,
+ const char* const parameters[],
+ char** errorbuf);
+};
+
+namespace sandbox {
+
+// static
+int Seatbelt::Init(const char* profile, uint64_t flags, char** errorbuf) {
+#pragma clang diagnostic push
Nico 2016/04/05 18:37:18 This still needs a comment why ignoring the diagno
Greg K 2016/04/05 18:44:53 Done.
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return ::sandbox_init(profile, flags, errorbuf);
+#pragma clang diagnostic pop
+}
+
+// static
+int Seatbelt::InitWithParams(const char* profile,
+ uint64_t flags,
+ const char* const parameters[],
+ char** errorbuf) {
+ return ::sandbox_init_with_parameters(profile, flags, parameters, errorbuf);
+}
+
+// static
+void Seatbelt::FreeError(char* errorbuf) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return ::sandbox_free_error(errorbuf);
Nico 2016/04/05 18:37:18 likewise
Greg K 2016/04/05 18:44:54 Done.
+#pragma clang diagnostic pop
+}
+
+} // namespace sandbox
« sandbox/mac/seatbelt.h ('K') | « sandbox/mac/seatbelt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698