feature_list.cc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "electron/shell/browser/feature_list.h"
  5. #include <string>
  6. #include "base/base_switches.h"
  7. #include "base/command_line.h"
  8. #include "base/feature_list.h"
  9. #include "content/public/common/content_features.h"
  10. #include "electron/buildflags/buildflags.h"
  11. #include "media/base/media_switches.h"
  12. namespace electron {
  13. void InitializeFeatureList() {
  14. auto* cmd_line = base::CommandLine::ForCurrentProcess();
  15. auto enable_features =
  16. cmd_line->GetSwitchValueASCII(::switches::kEnableFeatures);
  17. auto disable_features =
  18. cmd_line->GetSwitchValueASCII(::switches::kDisableFeatures);
  19. // Disable creation of spare renderer process with site-per-process mode,
  20. // it interferes with our process preference tracking for non sandboxed mode.
  21. // Can be reenabled when our site instance policy is aligned with chromium
  22. // when node integration is enabled.
  23. disable_features +=
  24. std::string(",") + features::kSpareRendererForSitePerProcess.name;
  25. // https://www.polymer-project.org/blog/2018-10-02-webcomponents-v0-deprecations
  26. // https://chromium-review.googlesource.com/c/chromium/src/+/1869562
  27. // Any website which uses older WebComponents will fail in without this
  28. // enabled, since Electron does not support origin trials.
  29. enable_features += std::string(",") + "WebComponentsV0Enabled";
  30. #if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
  31. disable_features += std::string(",") + media::kPictureInPicture.name;
  32. #endif
  33. base::FeatureList::InitializeInstance(enable_features, disable_features);
  34. }
  35. } // namespace electron