| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/content_switches_internal.h" | 5 #include "content/common/content_switches_internal.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
| 16 #include "ui/gfx/win/direct_write.h" | 16 #include "ui/gfx/win/direct_write.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 #if defined(OS_WIN) | |
| 24 static bool g_win32k_renderer_lockdown_disabled = false; | |
| 25 #endif | |
| 26 | |
| 27 bool IsUseZoomForDSFEnabledByDefault() { | 23 bool IsUseZoomForDSFEnabledByDefault() { |
| 28 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 29 return true; | 25 return true; |
| 30 #else | 26 #else |
| 31 return false; | 27 return false; |
| 32 #endif | 28 #endif |
| 33 } | 29 } |
| 34 | 30 |
| 35 } // namespace | 31 } // namespace |
| 36 | 32 |
| 37 bool IsPinchToZoomEnabled() { | 33 bool IsPinchToZoomEnabled() { |
| 38 const base::CommandLine& command_line = | 34 const base::CommandLine& command_line = |
| 39 *base::CommandLine::ForCurrentProcess(); | 35 *base::CommandLine::ForCurrentProcess(); |
| 40 | 36 |
| 41 // Enable pinch everywhere unless it's been explicitly disabled. | 37 // Enable pinch everywhere unless it's been explicitly disabled. |
| 42 return !command_line.HasSwitch(switches::kDisablePinch); | 38 return !command_line.HasSwitch(switches::kDisablePinch); |
| 43 } | 39 } |
| 44 | 40 |
| 45 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 46 | 42 |
| 47 void DisableWin32kRendererLockdown() { | |
| 48 g_win32k_renderer_lockdown_disabled = true; | |
| 49 } | |
| 50 | |
| 51 bool IsWin32kRendererLockdownEnabled() { | 43 bool IsWin32kRendererLockdownEnabled() { |
| 52 if (g_win32k_renderer_lockdown_disabled) | |
| 53 return false; | |
| 54 if (base::win::GetVersion() < base::win::VERSION_WIN8) | 44 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
| 55 return false; | 45 return false; |
| 56 if (!gfx::win::ShouldUseDirectWrite()) | 46 if (!gfx::win::ShouldUseDirectWrite()) |
| 57 return false; | 47 return false; |
| 58 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 48 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 59 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) | 49 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) |
| 60 return false; | 50 return false; |
| 61 return true; | 51 return true; |
| 62 } | 52 } |
| 63 | 53 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 88 bool enabled = | 78 bool enabled = |
| 89 (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || | 79 (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || |
| 90 use_zoom_for_dsf_enabled_by_default) && | 80 use_zoom_for_dsf_enabled_by_default) && |
| 91 command_line->GetSwitchValueASCII( | 81 command_line->GetSwitchValueASCII( |
| 92 switches::kEnableUseZoomForDSF) != "false"; | 82 switches::kEnableUseZoomForDSF) != "false"; |
| 93 | 83 |
| 94 return enabled; | 84 return enabled; |
| 95 } | 85 } |
| 96 | 86 |
| 97 } // namespace content | 87 } // namespace content |
| OLD | NEW |