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

Side by Side Diff: chrome/nacl/nacl_main_platform_delegate_mac.mm

Issue 8589001: Load mac sandbox definitions from resources instead of the bundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: different approach Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/nacl/nacl_main_platform_delegate.h" 5 #include "chrome/nacl/nacl_main_platform_delegate.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/native_library.h" 11 #include "base/native_library.h"
12 #include "chrome/common/chrome_sandbox_process_type_mac.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "content/common/sandbox_mac.h" 14 #include "content/common/sandbox_mac.h"
14 #include "content/public/common/sandbox_init.h" 15 #include "content/public/common/sandbox_init.h"
16 #include "grit/browser_resources.h"
15 17
16 NaClMainPlatformDelegate::NaClMainPlatformDelegate( 18 NaClMainPlatformDelegate::NaClMainPlatformDelegate(
17 const content::MainFunctionParams& parameters) 19 const content::MainFunctionParams& parameters)
18 : parameters_(parameters), sandbox_test_module_(NULL) { 20 : parameters_(parameters), sandbox_test_module_(NULL) {
19 } 21 }
20 22
21 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() { 23 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() {
22 } 24 }
23 25
24 // TODO(jvoung): see if this old comment (from renderer_main_platform...) 26 // TODO(jvoung): see if this old comment (from renderer_main_platform...)
(...skipping 23 matching lines...) Expand all
48 FilePath test_dll_name = 50 FilePath test_dll_name =
49 command_line.GetSwitchValuePath(switches::kTestNaClSandbox); 51 command_line.GetSwitchValuePath(switches::kTestNaClSandbox);
50 if (!test_dll_name.empty()) { 52 if (!test_dll_name.empty()) {
51 sandbox_test_module_ = base::LoadNativeLibrary(test_dll_name, NULL); 53 sandbox_test_module_ = base::LoadNativeLibrary(test_dll_name, NULL);
52 CHECK(sandbox_test_module_); 54 CHECK(sandbox_test_module_);
53 } 55 }
54 } 56 }
55 } 57 }
56 58
57 void NaClMainPlatformDelegate::EnableSandbox() { 59 void NaClMainPlatformDelegate::EnableSandbox() {
58 CHECK(content::InitializeSandbox()) << "Error initializing sandbox for " 60 CHECK(content::InitializeSandbox(CHROME_SANDBOX_TYPE_NACL_LOADER, FilePath()))
59 << switches::kNaClLoaderProcess; 61 << "Error initializing sandbox for " << switches::kNaClLoaderProcess;
60 } 62 }
61 63
62 bool NaClMainPlatformDelegate::RunSandboxTests() { 64 bool NaClMainPlatformDelegate::RunSandboxTests() {
63 // TODO(jvoung): Win and mac should share this identical code. 65 // TODO(jvoung): Win and mac should share this identical code.
64 bool result = true; 66 bool result = true;
65 if (sandbox_test_module_) { 67 if (sandbox_test_module_) {
66 RunNaClLoaderTests run_security_tests = 68 RunNaClLoaderTests run_security_tests =
67 reinterpret_cast<RunNaClLoaderTests>( 69 reinterpret_cast<RunNaClLoaderTests>(
68 base::GetFunctionPointerFromNativeLibrary(sandbox_test_module_, 70 base::GetFunctionPointerFromNativeLibrary(sandbox_test_module_,
69 kNaClLoaderTestCall)); 71 kNaClLoaderTestCall));
70 if (run_security_tests) { 72 if (run_security_tests) {
71 DVLOG(1) << "Running NaCl Loader security tests"; 73 DVLOG(1) << "Running NaCl Loader security tests";
72 result = (*run_security_tests)(); 74 result = (*run_security_tests)();
73 } else { 75 } else {
74 VLOG(1) << "Failed to get NaCl sandbox test function"; 76 VLOG(1) << "Failed to get NaCl sandbox test function";
75 result = false; 77 result = false;
76 } 78 }
77 base::UnloadNativeLibrary(sandbox_test_module_); 79 base::UnloadNativeLibrary(sandbox_test_module_);
78 sandbox_test_module_ = NULL; 80 sandbox_test_module_ = NULL;
79 } 81 }
80 return result; 82 return result;
81 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698