summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_shutdown.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:11:54 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:11:54 +0000
commitb1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e (patch)
treed6e9f57d10714b67c4c7fbed0e874d4e337f406e /chrome/browser/browser_shutdown.cc
parenta8e4a8fa39604cd309e1e3d62cf9c552dcfe541d (diff)
downloadchromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.zip
chromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.tar.gz
chromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.tar.bz2
Implement upgrade notifications.
When we detect that the installed version is newer than the version you are running we show a little throbbing orange dot over the wrench menu. If you open the wrench menu and close it again, the throbbing will stop. However, if you look at the contents of the wrench menu you'll notice that the About box menu item has been removed and in its place is a menu item "Update Chrome Now" with a bright orange icon to draw your attention to it. Clicking on the icon shows a dialog box asking whether you want to restart Chrome. If you do, the browser restarts with your session restored (even if you have Session Restore turned off). Known issues: - Currently this is Windows only. We'll have to port this to Linux and do something differnet for Mac (which doesn't have the wrench menu). - Showing an icon in front of Update Chrome causes the checkbox for the bookmark bar menu to go away. Given that we will soon redesign the menus I'm not going to spend much time trying to fix it. BUG=27941 TEST=Wait for Chrome to be upgraded in the background, an orange dot should appear over the wrench menu and if you select Update Chrome your session should be retained. Review URL: http://codereview.chromium.org/2225003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_shutdown.cc')
-rw-r--r--chrome/browser/browser_shutdown.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index c052790..af5bc26 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -28,6 +28,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "net/dns_global.h"
@@ -128,6 +129,14 @@ void Shutdown() {
shutdown_num_processes_slow_);
}
+ // Check local state for the restart flag so we can restart the session below.
+ bool restart_last_session = false;
+ if (prefs->HasPrefPath(prefs::kRestartLastSessionOnShutdown)) {
+ restart_last_session =
+ prefs->GetBoolean(prefs::kRestartLastSessionOnShutdown);
+ prefs->ClearPref(prefs::kRestartLastSessionOnShutdown);
+ }
+
prefs->SavePersistentPrefs();
#if defined(OS_WIN)
@@ -152,6 +161,20 @@ void Shutdown() {
shutdown_type_ != browser_shutdown::END_SESSION) {
Upgrade::SwapNewChromeExeIfPresent();
}
+
+ if (restart_last_session) {
+ // Make sure to relaunch the browser with the same command line and add
+ // Restore Last Session flag if session restore is not set.
+ CommandLine command_line = CommandLine::FromString(
+ CommandLine::ForCurrentProcess()->command_line_string());
+ if (!command_line.HasSwitch(switches::kRestoreLastSession))
+ command_line.AppendSwitch(switches::kRestoreLastSession);
+ Upgrade::RelaunchChromeBrowser(command_line);
+ }
+#endif
+#if !defined(OS_WIN)
+ if (restart_last_session)
+ NOTIMPLEMENTED();
#endif
if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) {