Files
cef/patch/patches/chrome_browser_startup.patch
T
Marshall Greenblatt 33624e6bc2 Update to Chromium version 154.0.8037.0
- Windows SDK 10.0.28000.2270 is now required
- CefRegisterExtension is deprecated due to https://crbug.com/40347662
2026-09-06 13:10:22 -04:00

70 lines
2.7 KiB
Diff

diff --git chrome/browser/ui/startup/startup_browser_creator.cc chrome/browser/ui/startup/startup_browser_creator.cc
index 0b8d0aabf04ed3998c145c7ec18585d7b9033dcc..edc4fea063bb4185691fdf8a162fcfdc14b69c66 100644
--- chrome/browser/ui/startup/startup_browser_creator.cc
+++ chrome/browser/ui/startup/startup_browser_creator.cc
@@ -659,6 +659,13 @@ std::optional<bool> MaybeHandleValidateCrx(
return false;
}
+StartupBrowserCreator::ProcessCommandLineCallback*
+GetProcessCommandLineCallback() {
+ static base::NoDestructor<StartupBrowserCreator::ProcessCommandLineCallback>
+ callback;
+ return callback.get();
+}
+
} // namespace
StartupBrowserCreator::StartupBrowserCreator() = default;
@@ -1546,6 +1553,12 @@ void StartupBrowserCreator::ProcessCommandLineWithProfile(
{profile, mode}, last_opened_profiles);
}
+// static
+void StartupBrowserCreator::RegisterProcessCommandLineCallback(
+ ProcessCommandLineCallback cb) {
+ *GetProcessCommandLineCallback() = cb;
+}
+
// static
void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
const base::CommandLine& command_line,
@@ -1555,6 +1568,11 @@ void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
return;
}
+ auto* cb = GetProcessCommandLineCallback();
+ if (!cb->is_null() && cb->Run(command_line, cur_dir)) {
+ return;
+ }
+
Profile* profile = nullptr;
if (profile_path_info.mode == StartupProfileMode::kBrowserWindow) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
diff --git chrome/browser/ui/startup/startup_browser_creator.h chrome/browser/ui/startup/startup_browser_creator.h
index e48593c685e5216c784c355f2eed61586affd531..d44a3f22816484117b3e29581ecf2d677f7f9089 100644
--- chrome/browser/ui/startup/startup_browser_creator.h
+++ chrome/browser/ui/startup/startup_browser_creator.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/files/file_path.h"
+#include "base/functional/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
@@ -93,6 +94,13 @@ class StartupBrowserCreator {
StartupProfileInfo profile_info,
const Profiles& last_opened_profiles);
+ // Registers a callback that will be executed each time
+ // ProcessCommandLineAlreadyRunning is called.
+ using ProcessCommandLineCallback = base::RepeatingCallback<bool(
+ const base::CommandLine& command_line,
+ const base::FilePath& cur_dir)>;
+ static void RegisterProcessCommandLineCallback(ProcessCommandLineCallback cb);
+
// This function performs command-line handling and is invoked only after
// start up (for example when we get a start request for another process).
// |command_line| holds the command line we need to process.