From d9fcd263ece8e879e2e98a1cd7477d255abbbdb4 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Fri, 24 Jun 2011 15:59:02 +0000 Subject: Fix relaunches on the Mac. Relaunches that go through browser_shutdown and relaunches after install-from-disk-image should both be improved. browser_shutdown relaunches include those that occur when Chrome detects a new version and offers to relaunch itself, and those that occur when you change about:flags and click "Relaunch Now." When relaunching Chrome in the same location via browser_shutdown, the same Dock tile should now always be reused, provided that the tile is persistent, meaning that the user has chosen "Keep in Dock" from the tile's contextual menu. The relaunched process' activation status (foreground or background application) should now track the original process' activation status. BUG=42962, 85073 TEST=1a. Change something in about:flags and hit "Relaunch Now" at the bottom. If you had a persistent Dock tile, the same tile should be used for the relaunched browser every time, without fail. 1b. Same, but once you're running a version of Chrome (including a canary) with this fix, when an update is applied and you relaunch from within the application via the "Update Google Chrome" item in the wrench menu or the "Relaunch" button in the about window, the same tile should be used for the relaunched browser every time, without fail. 2. Relaunch after install from disk image. Remove Chrome from /Applications and double-click the Chrome icon in a read-only disk image carrying a version that has this fix. (Our official or canary disk images will work). Chrome will offer to install itself. Let it. Upon completion of the installation, Chrome should launch out of /Applications properly. If you had a persistent Dock tile pointing to a copy in /Applications, it will be used. Activation status (foreground or background) in the relaunched browser will match the status in the process that had run out of the disk image at the time that the installation completed. Review URL: http://codereview.chromium.org/7215040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90371 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/first_run/upgrade_util.h | 18 ++++++++++++++---- chrome/browser/first_run/upgrade_util_mac.cc | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 chrome/browser/first_run/upgrade_util_mac.cc (limited to 'chrome/browser/first_run') diff --git a/chrome/browser/first_run/upgrade_util.h b/chrome/browser/first_run/upgrade_util.h index 89302b2..8a87c89 100644 --- a/chrome/browser/first_run/upgrade_util.h +++ b/chrome/browser/first_run/upgrade_util.h @@ -6,20 +6,26 @@ #define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ #pragma once +#include "build/build_config.h" + +#if !defined(OS_CHROMEOS) + class CommandLine; namespace upgrade_util { +// Launches Chrome again simulating a "user" launch. If Chrome could not be +// launched, returns false. +bool RelaunchChromeBrowser(const CommandLine& command_line); + +#if !defined(OS_MACOSX) + void SetNewCommandLine(CommandLine* new_command_line); // Launches a new instance of the browser if the current instance in persistent // mode an upgrade is detected. void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); -// Launches chrome again simulating a 'user' launch. If chrome could not be -// launched the return is false. -bool RelaunchChromeBrowser(const CommandLine& command_line); - // Windows: // Checks if chrome_new.exe is present in the current instance's install. // Linux: @@ -27,6 +33,10 @@ bool RelaunchChromeBrowser(const CommandLine& command_line); // running instance. bool IsUpdatePendingRestart(); +#endif // !defined(OS_MACOSX) + } // namespace upgrade_util +#endif // !defined(OS_CHROMEOS) + #endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ diff --git a/chrome/browser/first_run/upgrade_util_mac.cc b/chrome/browser/first_run/upgrade_util_mac.cc new file mode 100644 index 0000000..0176fb0 --- /dev/null +++ b/chrome/browser/first_run/upgrade_util_mac.cc @@ -0,0 +1,14 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "chrome/browser/mac/relauncher.h" + +namespace upgrade_util { + +bool RelaunchChromeBrowser(const CommandLine& command_line) { + return mac_relauncher::RelaunchApp(command_line.argv()); +} + +} // namespace upgrade_util -- cgit v1.1