• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4 
5 #include "include/cef_app.h"
6 #include "include/wrapper/cef_library_loader.h"
7 
8 // When generating projects with CMake the CEF_USE_SANDBOX value will be defined
9 // automatically. Pass -DUSE_SANDBOX=OFF to the CMake command-line to disable
10 // use of the sandbox.
11 #if defined(CEF_USE_SANDBOX)
12 #include "include/cef_sandbox_mac.h"
13 #endif
14 
15 // Entry point function for sub-processes.
main(int argc,char * argv[])16 int main(int argc, char* argv[]) {
17 #if defined(CEF_USE_SANDBOX)
18   // Initialize the macOS sandbox for this helper process.
19   CefScopedSandboxContext sandbox_context;
20   if (!sandbox_context.Initialize(argc, argv))
21     return 1;
22 #endif
23 
24   // Load the CEF framework library at runtime instead of linking directly
25   // as required by the macOS sandbox implementation.
26   CefScopedLibraryLoader library_loader;
27   if (!library_loader.LoadInHelper())
28     return 1;
29 
30   // Provide CEF with command-line arguments.
31   CefMainArgs main_args(argc, argv);
32 
33   // Execute the sub-process.
34   return CefExecuteProcess(main_args, nullptr, nullptr);
35 }
36