mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-11 09:08:06 +01:00
5d817b20a6
mac: Switch to Xcode 16.0 16A242d with macOS SDK 15.0 24A336
70 lines
2.6 KiB
Diff
70 lines
2.6 KiB
Diff
diff --git chrome/browser/ui/startup/startup_browser_creator.cc chrome/browser/ui/startup/startup_browser_creator.cc
|
|
index 5e4078d747c74..e1c41cb1a8cda 100644
|
|
--- chrome/browser/ui/startup/startup_browser_creator.cc
|
|
+++ chrome/browser/ui/startup/startup_browser_creator.cc
|
|
@@ -616,6 +616,13 @@ std::optional<ash::KioskAppId> GetAppId(const base::CommandLine& command_line,
|
|
}
|
|
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
|
|
|
+StartupBrowserCreator::ProcessCommandLineCallback*
|
|
+GetProcessCommandLineCallback() {
|
|
+ static base::NoDestructor<StartupBrowserCreator::ProcessCommandLineCallback>
|
|
+ callback;
|
|
+ return callback.get();
|
|
+}
|
|
+
|
|
} // namespace
|
|
|
|
StartupProfileMode StartupProfileModeFromReason(
|
|
@@ -1481,6 +1488,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,
|
|
@@ -1490,6 +1503,11 @@ void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
|
|
return;
|
|
}
|
|
|
|
+ auto* cb = GetProcessCommandLineCallback();
|
|
+ if (!cb->is_null() && cb->Run(command_line, cur_dir)) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
Profile* profile = nullptr;
|
|
StartupProfileMode mode =
|
|
StartupProfileModeFromReason(profile_path_info.reason);
|
|
diff --git chrome/browser/ui/startup/startup_browser_creator.h chrome/browser/ui/startup/startup_browser_creator.h
|
|
index 919bae5ccfeae..5c2dfbf955723 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"
|
|
@@ -135,6 +136,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.
|