• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git chrome/browser/profiles/off_the_record_profile_impl.cc chrome/browser/profiles/off_the_record_profile_impl.cc
2index d153cc5837e0e..5154b21d819ed 100644
3--- chrome/browser/profiles/off_the_record_profile_impl.cc
4+++ chrome/browser/profiles/off_the_record_profile_impl.cc
5@@ -616,7 +616,9 @@ std::unique_ptr<Profile> Profile::CreateOffTheRecordProfile(
6 #endif
7   if (!profile)
8     profile = std::make_unique<OffTheRecordProfileImpl>(parent, otr_profile_id);
9-  profile->Init();
10+  // With CEF we want to delay initialization.
11+  if (!otr_profile_id.IsUniqueForCEF())
12+    profile->Init();
13   return std::move(profile);
14 }
15
16diff --git chrome/browser/profiles/profile.cc chrome/browser/profiles/profile.cc
17index a3fadab7e4e6b..032300a4c4a0b 100644
18--- chrome/browser/profiles/profile.cc
19+++ chrome/browser/profiles/profile.cc
20@@ -84,6 +84,7 @@ base::LazyInstance<std::set<content::BrowserContext*>>::Leaky
21
22 namespace {
23
24+const char kCEFOTRProfileIDPrefix[] = "CEF::BrowserContext";
25 const char kDevToolsOTRProfileIDPrefix[] = "Devtools::BrowserContext";
26 const char kMediaRouterOTRProfileIDPrefix[] = "MediaRouter::Presentation";
27 const char kTestOTRProfileIDPrefix[] = "Test::OTR";
28@@ -98,6 +99,8 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const {
29   // DevTools::BrowserContext and MediaRouter::Presentation are an
30   // exception to this ban.
31   return *this == PrimaryID() ||
32+         base::StartsWith(profile_id_, kCEFOTRProfileIDPrefix,
33+                          base::CompareCase::SENSITIVE) ||
34          base::StartsWith(profile_id_, kDevToolsOTRProfileIDPrefix,
35                           base::CompareCase::SENSITIVE) ||
36          base::StartsWith(profile_id_, kMediaRouterOTRProfileIDPrefix,
37@@ -119,6 +122,16 @@ Profile::OTRProfileID Profile::OTRProfileID::CreateUnique(
38       base::GUID::GenerateRandomV4().AsLowercaseString().c_str()));
39 }
40
41+// static
42+Profile::OTRProfileID Profile::OTRProfileID::CreateUniqueForCEF() {
43+  return CreateUnique(kCEFOTRProfileIDPrefix);
44+}
45+
46+bool Profile::OTRProfileID::IsUniqueForCEF() const {
47+  return base::StartsWith(profile_id_, kCEFOTRProfileIDPrefix,
48+                          base::CompareCase::SENSITIVE);
49+}
50+
51 // static
52 Profile::OTRProfileID Profile::OTRProfileID::CreateUniqueForDevTools() {
53   return CreateUnique(kDevToolsOTRProfileIDPrefix);
54diff --git chrome/browser/profiles/profile.h chrome/browser/profiles/profile.h
55index ca2561e412621..febd52df6c971 100644
56--- chrome/browser/profiles/profile.h
57+++ chrome/browser/profiles/profile.h
58@@ -98,6 +98,10 @@ class Profile : public content::BrowserContext {
59     // be applicable to run. Please see crbug.com/1098697#c3 for more details.
60     static OTRProfileID CreateUnique(const std::string& profile_id_prefix);
61
62+    // Creates a unique OTR profile id to be used for CEF browser contexts.
63+    static OTRProfileID CreateUniqueForCEF();
64+    bool IsUniqueForCEF() const;
65+
66     // Creates a unique OTR profile id to be used for DevTools browser contexts.
67     static OTRProfileID CreateUniqueForDevTools();
68
69@@ -480,6 +484,8 @@ class Profile : public content::BrowserContext {
70
71   virtual void RecordPrimaryMainFrameNavigation() = 0;
72
73+  void NotifyOffTheRecordProfileCreated(Profile* off_the_record);
74+
75  protected:
76   // Creates an OffTheRecordProfile which points to this Profile.
77   static std::unique_ptr<Profile> CreateOffTheRecordProfile(
78@@ -491,8 +497,6 @@ class Profile : public content::BrowserContext {
79   static PrefStore* CreateExtensionPrefStore(Profile*,
80                                              bool incognito_pref_store);
81
82-  void NotifyOffTheRecordProfileCreated(Profile* off_the_record);
83-
84   // Returns whether the user has signed in this profile to an account.
85   virtual bool IsSignedIn() = 0;
86
87diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
88index 1c79ba2998e34..d0518d23944a7 100644
89--- chrome/browser/profiles/profile_impl.cc
90+++ chrome/browser/profiles/profile_impl.cc
91@@ -998,7 +998,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
92
93   otr_profiles_[otr_profile_id] = std::move(otr_profile);
94
95-  NotifyOffTheRecordProfileCreated(raw_otr_profile);
96+  // With CEF we want to delay initialization.
97+  if (!otr_profile_id.IsUniqueForCEF())
98+    NotifyOffTheRecordProfileCreated(raw_otr_profile);
99
100   return raw_otr_profile;
101 }
102diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
103index e443ba3df4107..d3656b3cff757 100644
104--- chrome/browser/profiles/profile_manager.cc
105+++ chrome/browser/profiles/profile_manager.cc
106@@ -496,7 +496,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
107                           base::Unretained(this)));
108 #endif
109
110-  if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir_.empty())
111+  if (!user_data_dir_.empty() && ProfileShortcutManager::IsFeatureEnabled())
112     profile_shortcut_manager_ = ProfileShortcutManager::Create(this);
113
114   zombie_metrics_timer_.Start(FROM_HERE, base::Minutes(30), this,
115diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
116index 0719f998c0097..33e392a076183 100644
117--- chrome/browser/profiles/profile_manager.h
118+++ chrome/browser/profiles/profile_manager.h
119@@ -150,7 +150,7 @@ class ProfileManager : public Profile::Delegate {
120   // acceptable. Returns null if creation of the new profile fails.
121   // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
122   // make this method private.
123-  Profile* GetProfile(const base::FilePath& profile_dir);
124+  virtual Profile* GetProfile(const base::FilePath& profile_dir);
125
126   // Returns regular or off-the-record profile given its profile key.
127   static Profile* GetProfileFromProfileKey(ProfileKey* profile_key);
128@@ -182,7 +182,7 @@ class ProfileManager : public Profile::Delegate {
129
130   // Returns true if the profile pointer is known to point to an existing
131   // profile.
132-  bool IsValidProfile(const void* profile);
133+  virtual bool IsValidProfile(const void* profile);
134
135   // Returns the directory where the first created profile is stored,
136   // relative to the user data directory currently in use.
137diff --git chrome/browser/profiles/renderer_updater.cc chrome/browser/profiles/renderer_updater.cc
138index a2c7b9c45e334..18017a6181a1e 100644
139--- chrome/browser/profiles/renderer_updater.cc
140+++ chrome/browser/profiles/renderer_updater.cc
141@@ -8,6 +8,7 @@
142
143 #include "base/bind.h"
144 #include "build/chromeos_buildflags.h"
145+#include "cef/libcef/features/runtime.h"
146 #include "chrome/browser/content_settings/content_settings_manager_delegate.h"
147 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
148 #include "chrome/browser/profiles/profile.h"
149@@ -60,8 +61,12 @@ void GetGuestViewDefaultContentSettingRules(
150 }  // namespace
151
152 RendererUpdater::RendererUpdater(Profile* profile) : profile_(profile) {
153+  if (cef::IsAlloyRuntimeEnabled()) {
154+    identity_manager_ = nullptr;
155+  } else {
156   identity_manager_ = IdentityManagerFactory::GetForProfile(profile);
157   identity_manager_observation_.Observe(identity_manager_.get());
158+  }
159 #if BUILDFLAG(IS_CHROMEOS_ASH)
160   oauth2_login_manager_ =
161       ash::OAuth2LoginManagerFactory::GetForProfile(profile_);
162