| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ | 5 #ifndef CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ |
| 6 #define CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ | 6 #define CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
| 10 #include "content/common/main_function_params.h" | 10 #include "content/public/common/main_function_params.h" |
| 11 | 11 |
| 12 typedef bool (*RunNaClLoaderTests)(void); | 12 typedef bool (*RunNaClLoaderTests)(void); |
| 13 const char kNaClLoaderTestCall[] = "RunNaClLoaderTests"; | 13 const char kNaClLoaderTestCall[] = "RunNaClLoaderTests"; |
| 14 | 14 |
| 15 class NaClMainPlatformDelegate { | 15 class NaClMainPlatformDelegate { |
| 16 public: | 16 public: |
| 17 explicit NaClMainPlatformDelegate(const MainFunctionParams& parameters); | 17 explicit NaClMainPlatformDelegate( |
| 18 const content::MainFunctionParams& parameters); |
| 18 ~NaClMainPlatformDelegate(); | 19 ~NaClMainPlatformDelegate(); |
| 19 | 20 |
| 20 // Called first thing and last thing in the process' lifecycle, i.e. before | 21 // Called first thing and last thing in the process' lifecycle, i.e. before |
| 21 // the sandbox is enabled. | 22 // the sandbox is enabled. |
| 22 void PlatformInitialize(); | 23 void PlatformInitialize(); |
| 23 void PlatformUninitialize(); | 24 void PlatformUninitialize(); |
| 24 | 25 |
| 25 // Gives us an opportunity to initialize state used for tests before enabling | 26 // Gives us an opportunity to initialize state used for tests before enabling |
| 26 // the sandbox. | 27 // the sandbox. |
| 27 void InitSandboxTests(bool no_sandbox); | 28 void InitSandboxTests(bool no_sandbox); |
| 28 | 29 |
| 29 // Initiate Lockdown. | 30 // Initiate Lockdown. |
| 30 void EnableSandbox(); | 31 void EnableSandbox(); |
| 31 | 32 |
| 32 // Runs the sandbox tests for the NaCl Loader, if tests supplied. | 33 // Runs the sandbox tests for the NaCl Loader, if tests supplied. |
| 33 // Cannot run again, after this (resources freed). | 34 // Cannot run again, after this (resources freed). |
| 34 // Returns false if the tests are supplied and fail. | 35 // Returns false if the tests are supplied and fail. |
| 35 bool RunSandboxTests(); | 36 bool RunSandboxTests(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 const MainFunctionParams& parameters_; | 39 const content::MainFunctionParams& parameters_; |
| 39 base::NativeLibrary sandbox_test_module_; | 40 base::NativeLibrary sandbox_test_module_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(NaClMainPlatformDelegate); | 42 DISALLOW_COPY_AND_ASSIGN(NaClMainPlatformDelegate); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 #endif // CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ | 45 #endif // CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ |
| OLD | NEW |