| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <objc/runtime.h> | 8 #include <objc/runtime.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
| 13 #include "content/common/sandbox_mac.h" | 13 #include "content/common/sandbox_mac.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #import "content/public/common/injection_test_mac.h" | 15 #import "content/public/common/injection_test_mac.h" |
| 16 #include "content/common/sandbox_init_mac.h" | 16 #include "content/common/sandbox_init_mac.h" |
| 17 | 17 |
| 18 namespace content { |
| 19 |
| 18 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 20 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 19 const content::MainFunctionParams& parameters) | 21 const MainFunctionParams& parameters) |
| 20 : parameters_(parameters) { | 22 : parameters_(parameters) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 25 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 24 } | 26 } |
| 25 | 27 |
| 26 // TODO(mac-port): Any code needed to initialize a process for purposes of | 28 // TODO(mac-port): Any code needed to initialize a process for purposes of |
| 27 // running a renderer needs to also be reflected in chrome_main.cc for | 29 // running a renderer needs to also be reflected in chrome_main.cc for |
| 28 // --single-process support. | 30 // --single-process support. |
| 29 void RendererMainPlatformDelegate::PlatformInitialize() { | 31 void RendererMainPlatformDelegate::PlatformInitialize() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 NOTREACHED() << "Failed to load bundle"; | 67 NOTREACHED() << "Failed to load bundle"; |
| 66 return false; | 68 return false; |
| 67 } | 69 } |
| 68 sandbox_tests_bundle_ = [tests_bundle retain]; | 70 sandbox_tests_bundle_ = [tests_bundle retain]; |
| 69 [objc_getClass("RendererSandboxTestsRunner") setLogFunction:LogTestMessage]; | 71 [objc_getClass("RendererSandboxTestsRunner") setLogFunction:LogTestMessage]; |
| 70 } | 72 } |
| 71 return true; | 73 return true; |
| 72 } | 74 } |
| 73 | 75 |
| 74 bool RendererMainPlatformDelegate::EnableSandbox() { | 76 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 75 return content::InitializeSandbox(); | 77 return InitializeSandbox(); |
| 76 } | 78 } |
| 77 | 79 |
| 78 void RendererMainPlatformDelegate::RunSandboxTests() { | 80 void RendererMainPlatformDelegate::RunSandboxTests() { |
| 79 Class tests_runner = objc_getClass("RendererSandboxTestsRunner"); | 81 Class tests_runner = objc_getClass("RendererSandboxTestsRunner"); |
| 80 if (tests_runner) { | 82 if (tests_runner) { |
| 81 if (![tests_runner runTests]) | 83 if (![tests_runner runTests]) |
| 82 LOG(ERROR) << "Running renderer with failing sandbox tests!"; | 84 LOG(ERROR) << "Running renderer with failing sandbox tests!"; |
| 83 [sandbox_tests_bundle_ unload]; | 85 [sandbox_tests_bundle_ unload]; |
| 84 [sandbox_tests_bundle_ release]; | 86 [sandbox_tests_bundle_ release]; |
| 85 sandbox_tests_bundle_ = nil; | 87 sandbox_tests_bundle_ = nil; |
| 86 } | 88 } |
| 87 } | 89 } |
| 90 |
| 91 } // namespace content |
| OLD | NEW |