diff --git a/chromium_src/chrome/browser/process_singleton_win.cc b/chromium_src/chrome/browser/process_singleton_win.cc index 6bcd9ad25d7f..427ce89a58e2 100644 --- a/chromium_src/chrome/browser/process_singleton_win.cc +++ b/chromium_src/chrome/browser/process_singleton_win.cc @@ -77,19 +77,6 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) { return !*result; } -// Convert Command line string to argv. -base::CommandLine::StringVector CommandLineStringToArgv( - const std::wstring& command_line_string) { - int num_args = 0; - wchar_t** args = NULL; - args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); - base::CommandLine::StringVector argv; - for (int i = 0; i < num_args; ++i) - argv.push_back(std::wstring(args[i])); - LocalFree(args); - return argv; -} - bool ParseCommandLine(const COPYDATASTRUCT* cds, base::CommandLine::StringVector* parsed_command_line, base::FilePath* current_directory) { @@ -143,7 +130,7 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds, // Get command line. const std::wstring cmd_line = msg.substr(second_null + 1, third_null - second_null); - *parsed_command_line = CommandLineStringToArgv(cmd_line); + *parsed_command_line = base::CommandLine::FromString(cmd_line).argv(); return true; } return false; diff --git a/docs/api/app.md b/docs/api/app.md index 8382944e619e..9d5183e1883a 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -398,6 +398,9 @@ non-minimized. This event is guaranteed to be emitted after the `ready` event of `app` gets emitted. +**Note:** Extra command line arguments might be added by Chromium, +such as `--original-process-start-time`. + ### Event: 'remote-require' Returns: diff --git a/patches/common/chromium/.patches b/patches/common/chromium/.patches index 715b6cc968b3..cbddb766ba8e 100644 --- a/patches/common/chromium/.patches +++ b/patches/common/chromium/.patches @@ -67,7 +67,6 @@ tts.patch color_chooser.patch printing.patch verbose_generate_breakpad_symbols.patch -chrome_process_finder.patch customizable_app_indicator_id_prefix.patch cross_site_document_resource_handler.patch content_allow_embedder_to_prevent_locking_scheme_registry.patch diff --git a/patches/common/chromium/chrome_process_finder.patch b/patches/common/chromium/chrome_process_finder.patch deleted file mode 100644 index f8901ea9f665..000000000000 --- a/patches/common/chromium/chrome_process_finder.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Milan Burda -Date: Fri, 26 Oct 2018 20:45:49 +0200 -Subject: chrome_process_finder.patch - -Fix some problems when using app.makeSingleInstance on Windows -* The original command line of new instances are passed instead - of the one modified by Chromium. -* The command line is passed as Array. - -When using the app.makeSingleInstance API, the command line arguments -of the new instance will be passed to existing instance. Without this patch, -Chromium would append some new flags (kOriginalProcessStartTime and kFastStart). - -Reference: https://github.com/electron/electron/pull/3175 - -diff --git a/chrome/browser/win/chrome_process_finder.cc b/chrome/browser/win/chrome_process_finder.cc -index 4fdea2af27020303a66a747304c5ecce5cc698d5..598ba8171631dbcf7ad23bc4b5c74a750bbaa47c 100644 ---- a/chrome/browser/win/chrome_process_finder.cc -+++ b/chrome/browser/win/chrome_process_finder.cc -@@ -43,15 +43,6 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window, - if (!thread_id || !process_id) - return NOTIFY_FAILED; - -- base::CommandLine command_line(*base::CommandLine::ForCurrentProcess()); -- command_line.AppendSwitchASCII( -- switches::kOriginalProcessStartTime, -- base::Int64ToString( -- base::CurrentProcessInfo::CreationTime().ToInternalValue())); -- -- if (fast_start) -- command_line.AppendSwitch(switches::kFastStart); -- - // Send the command line to the remote chrome window. - // Format is "START\0<<>>\0<<>>". - std::wstring to_send(L"START\0", 6); // want the NULL in the string. -@@ -60,7 +51,7 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window, - return NOTIFY_FAILED; - to_send.append(cur_dir.value()); - to_send.append(L"\0", 1); // Null separator. -- to_send.append(command_line.GetCommandLineString()); -+ to_send.append(::GetCommandLineW()); - to_send.append(L"\0", 1); // Null separator. - - // Allow the current running browser window to make itself the foreground