| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" |
| 8 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 9 | 10 |
| 10 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
| 13 #include "ui/gfx/win/direct_write.h" |
| 12 #endif | 14 #endif |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 bool IsPinchToZoomEnabled() { | 18 bool IsPinchToZoomEnabled() { |
| 17 const base::CommandLine& command_line = | 19 const base::CommandLine& command_line = |
| 18 *base::CommandLine::ForCurrentProcess(); | 20 *base::CommandLine::ForCurrentProcess(); |
| 19 | 21 |
| 20 // --disable-pinch should always disable pinch | 22 // --disable-pinch should always disable pinch |
| 21 if (command_line.HasSwitch(switches::kDisablePinch)) | 23 if (command_line.HasSwitch(switches::kDisablePinch)) |
| 22 return false; | 24 return false; |
| 23 | 25 |
| 24 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 25 return base::win::GetVersion() >= base::win::VERSION_WIN8; | 27 return base::win::GetVersion() >= base::win::VERSION_WIN8; |
| 26 #elif defined(OS_CHROMEOS) | 28 #elif defined(OS_CHROMEOS) |
| 27 return true; | 29 return true; |
| 28 #else | 30 #else |
| 29 return command_line.HasSwitch(switches::kEnableViewport) || | 31 return command_line.HasSwitch(switches::kEnableViewport) || |
| 30 command_line.HasSwitch(switches::kEnablePinch); | 32 command_line.HasSwitch(switches::kEnablePinch); |
| 31 #endif | 33 #endif |
| 32 } | 34 } |
| 33 | 35 |
| 36 #if defined(OS_WIN) |
| 37 |
| 38 bool IsWin32kRendererLockdownEnabled() { |
| 39 const std::string group_name = |
| 40 base::FieldTrialList::FindFullName("Win32kLockdown"); |
| 41 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
| 42 return false; |
| 43 if (!gfx::win::ShouldUseDirectWrite()) |
| 44 return false; |
| 45 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 46 if (cmd_line->HasSwitch(switches::kEnableWin32kRendererLockDown)) |
| 47 return true; |
| 48 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) |
| 49 return false; |
| 50 // Default. |
| 51 return group_name == "Enabled"; |
| 52 } |
| 53 #endif |
| 54 |
| 34 } // namespace content | 55 } // namespace content |
| OLD | NEW |