Chromium Code Reviews| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 DCHECK(target_services); | 559 DCHECK(target_services); |
| 560 DCHECK(!g_target_services); | 560 DCHECK(!g_target_services); |
| 561 sandbox::ResultCode result = target_services->Init(); | 561 sandbox::ResultCode result = target_services->Init(); |
| 562 g_target_services = target_services; | 562 g_target_services = target_services; |
| 563 return sandbox::SBOX_ALL_OK == result; | 563 return sandbox::SBOX_ALL_OK == result; |
| 564 } | 564 } |
| 565 | 565 |
| 566 bool ShouldUseDirectWrite() { | 566 bool ShouldUseDirectWrite() { |
| 567 // If the flag is currently on, and we're on Win7 or above, we enable | 567 // If the flag is currently on, and we're on Win7 or above, we enable |
| 568 // DirectWrite. Skia does not require the additions to DirectWrite in QFE | 568 // DirectWrite. Skia does not require the additions to DirectWrite in QFE |
| 569 // 2670838, so a Win7 check is sufficient. We do not currently attempt to | 569 // 2670838, so a Win7 check is sufficient. We do not currently attempt to |
|
scottmg
2014/06/19 03:26:05
update this comment, apparently a win7 check isn't
| |
| 570 // support Vista, where SP2 and the Platform Update are required. | 570 // support Vista, where SP2 and the Platform Update are required. |
| 571 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 571 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 572 return false; | 572 return false; |
| 573 | 573 |
| 574 base::win::OSInfo::VersionNumber os_version = | |
| 575 base::win::OSInfo::GetInstance()->version_number(); | |
| 576 if ((os_version.major == 6) && (os_version.minor == 1)) { | |
| 577 // We can't use DirectWrite for pre-release versions of Windows 7. | |
| 578 if (os_version.build < 7600) | |
| 579 return false; | |
| 580 } | |
| 581 | |
| 574 // If forced off, don't use it. | 582 // If forced off, don't use it. |
| 575 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 583 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 576 if (command_line.HasSwitch(switches::kDisableDirectWrite)) | 584 if (command_line.HasSwitch(switches::kDisableDirectWrite)) |
| 577 return false; | 585 return false; |
| 578 | 586 |
| 579 #if !defined(NACL_WIN64) | 587 #if !defined(NACL_WIN64) |
| 580 // Can't use GDI on HiDPI. | 588 // Can't use GDI on HiDPI. |
| 581 if (gfx::GetDPIScale() > 1.0f) | 589 if (gfx::GetDPIScale() > 1.0f) |
| 582 return true; | 590 return true; |
| 583 #endif | 591 #endif |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 } | 774 } |
| 767 | 775 |
| 768 return false; | 776 return false; |
| 769 } | 777 } |
| 770 | 778 |
| 771 bool BrokerAddTargetPeer(HANDLE peer_process) { | 779 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 772 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 780 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 773 } | 781 } |
| 774 | 782 |
| 775 } // namespace content | 783 } // namespace content |
| OLD | NEW |