| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 // TODO(jschuh): Need get these restrictions applied to NaCl and Pepper. | 569 // TODO(jschuh): Need get these restrictions applied to NaCl and Pepper. |
| 570 // Just have to figure out what needs to be warmed up first. | 570 // Just have to figure out what needs to be warmed up first. |
| 571 void AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) { | 571 void AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) { |
| 572 // TODO(cpu): Add back the BaseNamedObjects policy. | 572 // TODO(cpu): Add back the BaseNamedObjects policy. |
| 573 base::string16 object_path = PrependWindowsSessionPath( | 573 base::string16 object_path = PrependWindowsSessionPath( |
| 574 L"\\BaseNamedObjects\\windows_shell_global_counters"); | 574 L"\\BaseNamedObjects\\windows_shell_global_counters"); |
| 575 policy->AddKernelObjectToClose(L"Section", object_path.data()); | 575 policy->AddKernelObjectToClose(L"Section", object_path.data()); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void AddAppContainerPolicy(sandbox::TargetPolicy* policy, const wchar_t* sid) { |
| 579 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 580 const base::CommandLine& command_line = |
| 581 *base::CommandLine::ForCurrentProcess(); |
| 582 if (!command_line.HasSwitch(switches::kDisableAppContainer)) { |
| 583 policy->SetLowBox(sid); |
| 584 } |
| 585 } |
| 586 } |
| 587 |
| 578 bool InitBrokerServices(sandbox::BrokerServices* broker_services) { | 588 bool InitBrokerServices(sandbox::BrokerServices* broker_services) { |
| 579 // TODO(abarth): DCHECK(CalledOnValidThread()); | 589 // TODO(abarth): DCHECK(CalledOnValidThread()); |
| 580 // See <http://b/1287166>. | 590 // See <http://b/1287166>. |
| 581 DCHECK(broker_services); | 591 DCHECK(broker_services); |
| 582 DCHECK(!g_broker_services); | 592 DCHECK(!g_broker_services); |
| 583 sandbox::ResultCode result = broker_services->Init(); | 593 sandbox::ResultCode result = broker_services->Init(); |
| 584 g_broker_services = broker_services; | 594 g_broker_services = broker_services; |
| 585 | 595 |
| 586 // In non-official builds warn about dangerous uses of DuplicateHandle. | 596 // In non-official builds warn about dangerous uses of DuplicateHandle. |
| 587 #ifndef OFFICIAL_BUILD | 597 #ifndef OFFICIAL_BUILD |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 843 } |
| 834 | 844 |
| 835 return false; | 845 return false; |
| 836 } | 846 } |
| 837 | 847 |
| 838 bool BrokerAddTargetPeer(HANDLE peer_process) { | 848 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 839 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 849 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 840 } | 850 } |
| 841 | 851 |
| 842 } // namespace content | 852 } // namespace content |
| OLD | NEW |