• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git chrome/browser/themes/theme_service.cc chrome/browser/themes/theme_service.cc
2index 479ccaad2aa8f..fd57948a4af5e 100644
3--- chrome/browser/themes/theme_service.cc
4+++ chrome/browser/themes/theme_service.cc
5@@ -28,6 +28,7 @@
6 #include "base/task/thread_pool.h"
7 #include "base/threading/thread_task_runner_handle.h"
8 #include "build/build_config.h"
9+#include "cef/libcef/features/runtime.h"
10 #include "chrome/browser/browser_features.h"
11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
13@@ -63,6 +64,10 @@
14 #include "ui/base/layout.h"
15 #include "ui/color/color_provider.h"
16
17+#if BUILDFLAG(ENABLE_CEF)
18+#include "cef/libcef/common/extensions/extensions_util.h"
19+#endif
20+
21 #if BUILDFLAG(ENABLE_EXTENSIONS)
22 #include "base/scoped_observation.h"
23 #include "extensions/browser/extension_registry_observer.h"
24@@ -355,11 +360,19 @@ void ThemeService::Init() {
25   // OnExtensionServiceReady. Otherwise, the ThemeObserver won't be
26   // constructed in time to observe the corresponding events.
27 #if BUILDFLAG(ENABLE_EXTENSIONS)
28+#if BUILDFLAG(ENABLE_CEF)
29+  const bool extensions_disabled = cef::IsAlloyRuntimeEnabled() &&
30+                                   !extensions::ExtensionsEnabled();
31+#else
32+  const bool extensions_disabled = false;
33+#endif
34+  if (!extensions_disabled) {
35   theme_observer_ = std::make_unique<ThemeObserver>(this);
36
37   extensions::ExtensionSystem::Get(profile_)->ready().Post(
38       FROM_HERE, base::BindOnce(&ThemeService::OnExtensionServiceReady,
39                                 weak_ptr_factory_.GetWeakPtr()));
40+  }
41 #endif
42   theme_syncable_service_ =
43       std::make_unique<ThemeSyncableService>(profile_, this);
44diff --git chrome/browser/themes/theme_service_factory.cc chrome/browser/themes/theme_service_factory.cc
45index db3162c7ef194..f80a5755876ee 100644
46--- chrome/browser/themes/theme_service_factory.cc
47+++ chrome/browser/themes/theme_service_factory.cc
48@@ -7,6 +7,7 @@
49 #include "base/no_destructor.h"
50 #include "build/build_config.h"
51 #include "build/chromeos_buildflags.h"
52+#include "cef/libcef/features/runtime.h"
53 #include "chrome/browser/extensions/extension_system_factory.h"
54 #include "chrome/browser/profiles/incognito_helpers.h"
55 #include "chrome/browser/profiles/profile.h"
56@@ -30,6 +31,10 @@
57 #include "ui/views/linux_ui/linux_ui.h"
58 #endif
59
60+#if BUILDFLAG(ENABLE_CEF)
61+#include "cef/libcef/common/extensions/extensions_util.h"
62+#endif
63+
64 namespace {
65
66 const ThemeHelper& GetThemeHelper() {
67@@ -73,7 +78,15 @@ ThemeServiceFactory::ThemeServiceFactory()
68           BrowserContextDependencyManager::GetInstance()) {
69   DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
70   DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
71+#if BUILDFLAG(ENABLE_CEF)
72+  const bool extensions_disabled = cef::IsAlloyRuntimeEnabled() &&
73+                                   !extensions::ExtensionsEnabled();
74+#else
75+  const bool extensions_disabled = false;
76+#endif
77+  if (!extensions_disabled) {
78   DependsOn(extensions::ExtensionSystemFactory::GetInstance());
79+  }
80 }
81
82 ThemeServiceFactory::~ThemeServiceFactory() {}
83