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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "base/win/iat_patch_function.h" | 27 #include "base/win/iat_patch_function.h" |
28 #include "base/win/scoped_handle.h" | 28 #include "base/win/scoped_handle.h" |
29 #include "base/win/scoped_process_information.h" | 29 #include "base/win/scoped_process_information.h" |
30 #include "base/win/win_util.h" | 30 #include "base/win/win_util.h" |
31 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
32 #include "content/common/content_switches_internal.h" | 32 #include "content/common/content_switches_internal.h" |
33 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/dwrite_font_platform_win.h" |
35 #include "content/public/common/sandbox_init.h" | 36 #include "content/public/common/sandbox_init.h" |
36 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 37 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
37 #include "sandbox/win/src/process_mitigations.h" | 38 #include "sandbox/win/src/process_mitigations.h" |
38 #include "sandbox/win/src/sandbox.h" | 39 #include "sandbox/win/src/sandbox.h" |
39 #include "sandbox/win/src/sandbox_nt_util.h" | 40 #include "sandbox/win/src/sandbox_nt_util.h" |
40 #include "sandbox/win/src/sandbox_policy_base.h" | 41 #include "sandbox/win/src/sandbox_policy_base.h" |
41 #include "sandbox/win/src/win_utils.h" | 42 #include "sandbox/win/src/win_utils.h" |
42 | 43 |
43 #if !defined(NACL_WIN64) | 44 #if !defined(NACL_WIN64) |
44 #include "ui/gfx/win/direct_write.h" // nogncheck: unused #ifdef NACL_WIN64 | 45 #include "ui/gfx/win/direct_write.h" // nogncheck: unused #ifdef NACL_WIN64 |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 // process launch. | 750 // process launch. |
750 base::SharedMemory direct_write_font_cache_section; | 751 base::SharedMemory direct_write_font_cache_section; |
751 if (type_str == switches::kRendererProcess || | 752 if (type_str == switches::kRendererProcess || |
752 type_str == switches::kPpapiPluginProcess) { | 753 type_str == switches::kPpapiPluginProcess) { |
753 if (gfx::win::ShouldUseDirectWrite()) { | 754 if (gfx::win::ShouldUseDirectWrite()) { |
754 AddDirectory(base::DIR_WINDOWS_FONTS, | 755 AddDirectory(base::DIR_WINDOWS_FONTS, |
755 NULL, | 756 NULL, |
756 true, | 757 true, |
757 sandbox::TargetPolicy::FILES_ALLOW_READONLY, | 758 sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
758 policy); | 759 policy); |
| 760 |
| 761 if (!ShouldUseDirectWriteFontProxyFieldTrial()) { |
| 762 // If DirectWrite is enabled for font rendering then open the font |
| 763 // cache section which is created by the browser and pass the handle to |
| 764 // the renderer process. This is needed because renderer processes on |
| 765 // Windows 8+ may be running in an AppContainer sandbox and hence their |
| 766 // kernel object namespace may be partitioned. |
| 767 std::string name(content::kFontCacheSharedSectionName); |
| 768 name.append(base::UintToString(base::GetCurrentProcId())); |
| 769 |
| 770 if (direct_write_font_cache_section.Open(name, true)) { |
| 771 HANDLE handle = direct_write_font_cache_section.handle().GetHandle(); |
| 772 policy->AddHandleToShare(handle); |
| 773 cmd_line->AppendSwitchASCII( |
| 774 switches::kFontCacheSharedHandle, |
| 775 base::UintToString(base::win::HandleToUint32(handle))); |
| 776 } |
| 777 } |
759 } | 778 } |
760 } | 779 } |
761 #endif | 780 #endif |
762 | 781 |
763 if (type_str != switches::kRendererProcess) { | 782 if (type_str != switches::kRendererProcess) { |
764 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 783 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
765 // this subprocess. See | 784 // this subprocess. See |
766 // http://code.google.com/p/chromium/issues/detail?id=25580 | 785 // http://code.google.com/p/chromium/issues/detail?id=25580 |
767 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 786 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
768 } | 787 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 878 } |
860 | 879 |
861 return false; | 880 return false; |
862 } | 881 } |
863 | 882 |
864 bool BrokerAddTargetPeer(HANDLE peer_process) { | 883 bool BrokerAddTargetPeer(HANDLE peer_process) { |
865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 884 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
866 } | 885 } |
867 | 886 |
868 } // namespace content | 887 } // namespace content |
OLD | NEW |