chrome: Don't show the profile picker on startup (fixes issue #3440)

This commit is contained in:
Marshall Greenblatt 2023-01-19 16:20:29 -05:00
parent b065ca8cf4
commit 8b447e3a6f
2 changed files with 24 additions and 0 deletions

View File

@ -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,

View File

@ -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;