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/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 ProcessDebugFlags(cmd_line); | 598 ProcessDebugFlags(cmd_line); |
599 | 599 |
600 // Prefetch hints on windows: | 600 // Prefetch hints on windows: |
601 // Using a different prefetch profile per process type will allow Windows | 601 // Using a different prefetch profile per process type will allow Windows |
602 // to create separate pretetch settings for browser, renderer etc. | 602 // to create separate pretetch settings for browser, renderer etc. |
603 cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str))); | 603 cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str))); |
604 | 604 |
605 if ((delegate && !delegate->ShouldSandbox()) || | 605 if ((delegate && !delegate->ShouldSandbox()) || |
606 browser_command_line.HasSwitch(switches::kNoSandbox) || | 606 browser_command_line.HasSwitch(switches::kNoSandbox) || |
607 cmd_line->HasSwitch(switches::kNoSandbox)) { | 607 cmd_line->HasSwitch(switches::kNoSandbox)) { |
608 base::ProcessHandle handle = 0; | 608 base::Process process = |
609 base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle); | 609 base::LaunchProcess(*cmd_line, base::LaunchOptions()); |
610 // TODO(rvargas) crbug.com/417532: Don't share a raw handle. | 610 // TODO(rvargas) crbug.com/417532: Don't share a raw handle. |
611 g_broker_services->AddTargetPeer(handle); | 611 g_broker_services->AddTargetPeer(process.Handle()); |
612 return base::Process(handle); | 612 return process.Pass(); |
613 } | 613 } |
614 | 614 |
615 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); | 615 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); |
616 | 616 |
617 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | | 617 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | |
618 sandbox::MITIGATION_BOTTOM_UP_ASLR | | 618 sandbox::MITIGATION_BOTTOM_UP_ASLR | |
619 sandbox::MITIGATION_DEP | | 619 sandbox::MITIGATION_DEP | |
620 sandbox::MITIGATION_DEP_NO_ATL_THUNK | | 620 sandbox::MITIGATION_DEP_NO_ATL_THUNK | |
621 sandbox::MITIGATION_SEHOP; | 621 sandbox::MITIGATION_SEHOP; |
622 | 622 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 763 } |
764 | 764 |
765 return false; | 765 return false; |
766 } | 766 } |
767 | 767 |
768 bool BrokerAddTargetPeer(HANDLE peer_process) { | 768 bool BrokerAddTargetPeer(HANDLE peer_process) { |
769 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 769 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
770 } | 770 } |
771 | 771 |
772 } // namespace content | 772 } // namespace content |
OLD | NEW |