1 // Copyright 2015 The Chromium Embedded Framework Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be found 3 // in the LICENSE file. 4 5 #include "libcef/common/extensions/extensions_util.h" 6 7 #include "libcef/common/cef_switches.h" 8 9 #include "base/command_line.h" 10 #include "chrome/common/chrome_switches.h" 11 12 namespace extensions { 13 ExtensionsEnabled()14bool ExtensionsEnabled() { 15 static bool enabled = !base::CommandLine::ForCurrentProcess()->HasSwitch( 16 switches::kDisableExtensions); 17 return enabled; 18 } 19 PdfExtensionEnabled()20bool PdfExtensionEnabled() { 21 static bool enabled = 22 ExtensionsEnabled() && !base::CommandLine::ForCurrentProcess()->HasSwitch( 23 switches::kDisablePdfExtension); 24 return enabled; 25 } 26 PrintPreviewEnabled()27bool PrintPreviewEnabled() { 28 #if BUILDFLAG(IS_MAC) 29 // Not currently supported on macOS. 30 return false; 31 #else 32 if (!PdfExtensionEnabled()) 33 return false; 34 35 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 36 switches::kDisablePrintPreview)) { 37 return false; 38 } 39 40 return base::CommandLine::ForCurrentProcess()->HasSwitch( 41 switches::kEnablePrintPreview); 42 #endif 43 } 44 45 } // namespace extensions 46