| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/renderer_main_platform_delegate.h" | 5 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include <objbase.h> | |
| 8 | |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 11 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/test/injection_test_dll.h" | 10 #include "chrome/test/injection_test_dll.h" |
| 13 #include "sandbox/src/sandbox.h" | 11 #include "sandbox/src/sandbox.h" |
| 14 | 12 |
| 15 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 13 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 16 const MainFunctionParams& parameters) | 14 const MainFunctionParams& parameters) |
| 17 : parameters_(parameters), | 15 : parameters_(parameters), |
| 18 sandbox_test_module_(NULL) { | 16 sandbox_test_module_(NULL) { |
| 19 } | 17 } |
| 20 | 18 |
| 21 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 19 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 22 } | 20 } |
| 23 | 21 |
| 24 void RendererMainPlatformDelegate::PlatformInitialize() { | 22 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 25 CoInitialize(NULL); | 23 // Be mindful of what resources you acquire here. They can be used by |
| 24 // malicious code if the renderer gets compromised. |
| 26 } | 25 } |
| 27 | 26 |
| 28 void RendererMainPlatformDelegate::PlatformUninitialize() { | 27 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 29 CoUninitialize(); | |
| 30 } | 28 } |
| 31 | 29 |
| 32 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { | 30 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { |
| 33 const CommandLine& command_line = parameters_.command_line_; | 31 const CommandLine& command_line = parameters_.command_line_; |
| 34 | 32 |
| 35 DLOG(INFO) << "Started renderer with " << command_line.command_line_string(); | 33 DLOG(INFO) << "Started renderer with " << command_line.command_line_string(); |
| 36 | 34 |
| 37 sandbox::TargetServices* target_services = | 35 sandbox::TargetServices* target_services = |
| 38 parameters_.sandbox_info_.TargetServices(); | 36 parameters_.sandbox_info_.TargetServices(); |
| 39 | 37 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 69 kRenderTestCall)); | 67 kRenderTestCall)); |
| 70 DCHECK(run_security_tests); | 68 DCHECK(run_security_tests); |
| 71 if (run_security_tests) { | 69 if (run_security_tests) { |
| 72 int test_count = 0; | 70 int test_count = 0; |
| 73 DLOG(INFO) << "Running renderer security tests"; | 71 DLOG(INFO) << "Running renderer security tests"; |
| 74 BOOL result = run_security_tests(&test_count); | 72 BOOL result = run_security_tests(&test_count); |
| 75 CHECK(result) << "Test number " << test_count << " has failed."; | 73 CHECK(result) << "Test number " << test_count << " has failed."; |
| 76 } | 74 } |
| 77 } | 75 } |
| 78 } | 76 } |
| OLD | NEW |