| OLD | NEW |
| 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 "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 #import "chrome/test/security_tests/renderer_sandbox_tests_mac.h" | 13 #import "chrome/test/security_tests/renderer_sandbox_tests_mac.h" |
| 14 #include "content/common/sandbox_mac.h" | 14 #include "content/common/sandbox_mac.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/common/sandbox_init_mac.h" | 16 #include "content/common/sandbox_init_mac.h" |
| 17 #include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface
.h" | |
| 18 | 17 |
| 19 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 18 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 20 const content::MainFunctionParams& parameters) | 19 const content::MainFunctionParams& parameters) |
| 21 : parameters_(parameters) { | 20 : parameters_(parameters) { |
| 22 } | 21 } |
| 23 | 22 |
| 24 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 23 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 25 } | 24 } |
| 26 | 25 |
| 27 // TODO(mac-port): Any code needed to initialize a process for purposes of | 26 // TODO(mac-port): Any code needed to initialize a process for purposes of |
| 28 // running a renderer needs to also be reflected in chrome_main.cc for | 27 // running a renderer needs to also be reflected in chrome_main.cc for |
| 29 // --single-process support. | 28 // --single-process support. |
| 30 void RendererMainPlatformDelegate::PlatformInitialize() { | 29 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 31 // Initialize NSApplication up front. Without this call, drawing of | 30 // Initialize NSApplication up front. Without this call, drawing of |
| 32 // native UI elements (e.g. buttons) in WebKit will explode. | 31 // native UI elements (e.g. buttons) in WebKit will explode. |
| 33 [NSApplication sharedApplication]; | 32 [NSApplication sharedApplication]; |
| 34 | 33 |
| 35 // Load WebKit system interfaces. | |
| 36 InitWebCoreSystemInterface(); | |
| 37 | |
| 38 if (![NSThread isMultiThreaded]) { | 34 if (![NSThread isMultiThreaded]) { |
| 39 NSString* string = @""; | 35 NSString* string = @""; |
| 40 [NSThread detachNewThreadSelector:@selector(length) | 36 [NSThread detachNewThreadSelector:@selector(length) |
| 41 toTarget:string | 37 toTarget:string |
| 42 withObject:nil]; | 38 withObject:nil]; |
| 43 } | 39 } |
| 44 } | 40 } |
| 45 | 41 |
| 46 void RendererMainPlatformDelegate::PlatformUninitialize() { | 42 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 47 } | 43 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void RendererMainPlatformDelegate::RunSandboxTests() { | 78 void RendererMainPlatformDelegate::RunSandboxTests() { |
| 83 Class tests_runner = objc_getClass("RendererSandboxTestsRunner"); | 79 Class tests_runner = objc_getClass("RendererSandboxTestsRunner"); |
| 84 if (tests_runner) { | 80 if (tests_runner) { |
| 85 if (![tests_runner runTests]) | 81 if (![tests_runner runTests]) |
| 86 LOG(ERROR) << "Running renderer with failing sandbox tests!"; | 82 LOG(ERROR) << "Running renderer with failing sandbox tests!"; |
| 87 [sandbox_tests_bundle_ unload]; | 83 [sandbox_tests_bundle_ unload]; |
| 88 [sandbox_tests_bundle_ release]; | 84 [sandbox_tests_bundle_ release]; |
| 89 sandbox_tests_bundle_ = nil; | 85 sandbox_tests_bundle_ = nil; |
| 90 } | 86 } |
| 91 } | 87 } |
| OLD | NEW |