summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Greenblatt <magreenblatt@gmail.com>2023-01-19 16:20:29 -0500
committerMarshall Greenblatt <magreenblatt@gmail.com>2023-01-19 16:21:21 -0500
commit8b447e3a6f8a94b6d190217f6966016a4d8acae2 (patch)
treec44ad633ba992c580875970aa32fc44d0b93f91b
parentb065ca8cf40bbd30ac575b059372c964a4491595 (diff)
downloadcef-8b447e3a6f8a94b6d190217f6966016a4d8acae2.tar.gz
chrome: Don't show the profile picker on startup (fixes issue #3440)
-rw-r--r--libcef/common/chrome/chrome_main_delegate_cef.cc23
-rw-r--r--libcef/common/chrome/chrome_main_delegate_cef.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/libcef/common/chrome/chrome_main_delegate_cef.cc b/libcef/common/chrome/chrome_main_delegate_cef.cc
index dd6d9483..de9dbf3e 100644
--- a/libcef/common/chrome/chrome_main_delegate_cef.cc
+++ b/libcef/common/chrome/chrome_main_delegate_cef.cc
@@ -19,7 +19,9 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/threading/threading_features.h"
+#include "chrome/browser/metrics/chrome_feature_list_creator.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "components/embedder_support/switches.h"
#include "content/public/common/content_switches.h"
#include "sandbox/policy/switches.h"
@@ -204,6 +206,27 @@ absl::optional<int> ChromeMainDelegateCef::PreBrowserMain() {
return absl::nullopt;
}
+absl::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
+ InvokedIn invoked_in) {
+ const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
+ if (!result) {
+ const auto* invoked_in_browser =
+ absl::get_if<InvokedInBrowserProcess>(&invoked_in);
+ if (invoked_in_browser) {
+ // At this point local_state has been created but ownership has not yet
+ // been passed to BrowserProcessImpl (g_browser_process is nullptr).
+ auto* local_state = chrome_content_browser_client_->startup_data()
+ ->chrome_feature_list_creator()
+ ->local_state();
+
+ // Don't show the profile picker on startup (see issue #3440).
+ local_state->SetBoolean(prefs::kBrowserShowProfilePickerOnStartup, false);
+ }
+ }
+
+ return result;
+}
+
absl::variant<int, content::MainFunctionParams>
ChromeMainDelegateCef::RunProcess(
const std::string& process_type,
diff --git a/libcef/common/chrome/chrome_main_delegate_cef.h b/libcef/common/chrome/chrome_main_delegate_cef.h
index 4a4645b9..cfe768f0 100644
--- a/libcef/common/chrome/chrome_main_delegate_cef.h
+++ b/libcef/common/chrome/chrome_main_delegate_cef.h
@@ -39,6 +39,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
absl::optional<int> BasicStartupComplete() override;
void PreSandboxStartup() override;
absl::optional<int> PreBrowserMain() override;
+ absl::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;