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 base::win::GetVersion() == base::win::VERSION_WIN8_1) { |
| 581 const base::CommandLine& command_line = |
| 582 *base::CommandLine::ForCurrentProcess(); |
| 583 if (!command_line.HasSwitch(switches::kDisableAppContainer)) { |
| 584 policy->SetLowBox(sid); |
| 585 } |
| 586 } |
| 587 } |
| 588 |
578 bool InitBrokerServices(sandbox::BrokerServices* broker_services) { | 589 bool InitBrokerServices(sandbox::BrokerServices* broker_services) { |
579 // TODO(abarth): DCHECK(CalledOnValidThread()); | 590 // TODO(abarth): DCHECK(CalledOnValidThread()); |
580 // See <http://b/1287166>. | 591 // See <http://b/1287166>. |
581 DCHECK(broker_services); | 592 DCHECK(broker_services); |
582 DCHECK(!g_broker_services); | 593 DCHECK(!g_broker_services); |
583 sandbox::ResultCode result = broker_services->Init(); | 594 sandbox::ResultCode result = broker_services->Init(); |
584 g_broker_services = broker_services; | 595 g_broker_services = broker_services; |
585 | 596 |
586 // In non-official builds warn about dangerous uses of DuplicateHandle. | 597 // In non-official builds warn about dangerous uses of DuplicateHandle. |
587 #ifndef OFFICIAL_BUILD | 598 #ifndef OFFICIAL_BUILD |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } | 844 } |
834 | 845 |
835 return false; | 846 return false; |
836 } | 847 } |
837 | 848 |
838 bool BrokerAddTargetPeer(HANDLE peer_process) { | 849 bool BrokerAddTargetPeer(HANDLE peer_process) { |
839 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 850 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
840 } | 851 } |
841 | 852 |
842 } // namespace content | 853 } // namespace content |
OLD | NEW |