| 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/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include <dwrite.h> | 7 #include <dwrite.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); | 45 bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); |
| 46 | 46 |
| 47 if (!no_sandbox) { | 47 if (!no_sandbox) { |
| 48 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 48 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
| 49 // Olson timezone ID by accessing the registry keys under | 49 // Olson timezone ID by accessing the registry keys under |
| 50 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. | 50 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. |
| 51 // After TimeZone::createDefault is called once here, the timezone ID is | 51 // After TimeZone::createDefault is called once here, the timezone ID is |
| 52 // cached and there's no more need to access the registry. If the sandbox | 52 // cached and there's no more need to access the registry. If the sandbox |
| 53 // is disabled, we don't have to make this dummy call. | 53 // is disabled, we don't have to make this dummy call. |
| 54 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 54 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| 55 } |
| 55 | 56 |
| 56 InitializeDWriteFontProxy(); | 57 InitializeDWriteFontProxy(); |
| 57 } | 58 |
| 58 // TODO(robliao): This should use WebScreenInfo. See http://crbug.com/604555. | 59 // TODO(robliao): This should use WebScreenInfo. See http://crbug.com/604555. |
| 59 blink::WebFontRendering::setDeviceScaleFactor(display::win::GetDPIScale()); | 60 blink::WebFontRendering::setDeviceScaleFactor(display::win::GetDPIScale()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void RendererMainPlatformDelegate::PlatformUninitialize() { | 63 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 63 UninitializeDWriteFontProxy(); | 64 UninitializeDWriteFontProxy(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool RendererMainPlatformDelegate::EnableSandbox() { | 67 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 67 sandbox::TargetServices* target_services = | 68 sandbox::TargetServices* target_services = |
| 68 parameters_.sandbox_info->target_services; | 69 parameters_.sandbox_info->target_services; |
| 69 | 70 |
| 70 if (target_services) { | 71 if (target_services) { |
| 71 // Cause advapi32 to load before the sandbox is turned on. | 72 // Cause advapi32 to load before the sandbox is turned on. |
| 72 unsigned int dummy_rand; | 73 unsigned int dummy_rand; |
| 73 rand_s(&dummy_rand); | 74 rand_s(&dummy_rand); |
| 74 | 75 |
| 75 target_services->LowerToken(); | 76 target_services->LowerToken(); |
| 76 return true; | 77 return true; |
| 77 } | 78 } |
| 78 return false; | 79 return false; |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace content | 82 } // namespace content |
| OLD | NEW |