diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:16:23 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:16:23 +0000 |
commit | 28384a325c1646d45ef7c367e61871b20c6a4d0c (patch) | |
tree | 651701d012d88e2b73d17858ca7df6b420acea9f /chrome/browser/process_singleton_linux.cc | |
parent | d1388f48fc5971d3bddeca6dd6c0c44f63552063 (diff) | |
download | chromium_src-28384a325c1646d45ef7c367e61871b20c6a4d0c.zip chromium_src-28384a325c1646d45ef7c367e61871b20c6a4d0c.tar.gz chromium_src-28384a325c1646d45ef7c367e61871b20c6a4d0c.tar.bz2 |
Don't spontaneously open new windows.
When users downgrade, they may get a chrome binary that doesn't respect --product-version; don't allow chrome binaries launched with this flag to open new windows in existing chrome processes.
BUG=46547
TEST=manual
Review URL: http://codereview.chromium.org/2814007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49894 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton_linux.cc')
-rw-r--r-- | chrome/browser/process_singleton_linux.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index 2a1a01c..bfd6539 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -325,7 +325,8 @@ bool KillProcessByLockPath(const std::string& path) { int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); // ESRCH = No Such Process (can happen if the other process is already in // progress of shutting down and finishes before we try to kill it). - DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " << safe_strerror(errno); + DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " + << safe_strerror(errno); return true; } @@ -533,12 +534,22 @@ void ProcessSingleton::LinuxWatcher::HandleMessage( return; } - // Run the browser startup sequence again, with the command line of the - // signalling process. - FilePath current_dir_file_path(current_dir); - BrowserInit::ProcessCommandLine(parsed_command_line, - current_dir_file_path.ToWStringHack(), - false, profile, NULL); + // Ignore the request if the process was passed the --product-version flag. + // Normally we wouldn't get here if that flag had been passed, but it can + // happen if it is passed to an older version of chrome. Since newer versions + // of chrome do this in the background, we want to avoid spawning extra + // windows. + if (parsed_command_line.HasSwitch(switches::kProductVersion)) { + DLOG(WARNING) << "Remote process was passed product version flag, " + << "but ignored it. Doing nothing."; + } else { + // Run the browser startup sequence again, with the command line of the + // signalling process. + FilePath current_dir_file_path(current_dir); + BrowserInit::ProcessCommandLine(parsed_command_line, + current_dir_file_path.ToWStringHack(), + false, profile, NULL); + } // Send back "ACK" message to prevent the client process from starting up. reader->FinishWithACK(kACKToken, arraysize(kACKToken) - 1); |