summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/chrome_exe_main.cc1
-rw-r--r--chrome/app/chrome_exe_main_gtk.cc13
-rw-r--r--chrome/app/client_util.cc15
-rw-r--r--chrome/app/client_util.h4
4 files changed, 32 insertions, 1 deletions
diff --git a/chrome/app/chrome_exe_main.cc b/chrome/app/chrome_exe_main.cc
index fdd2cac..ed4c263 100644
--- a/chrome/app/chrome_exe_main.cc
+++ b/chrome/app/chrome_exe_main.cc
@@ -44,6 +44,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
// Load and launch the chrome dll. *Everything* happens inside.
MainDllLoader* loader = MakeMainDllLoader();
int rc = loader->Launch(instance, &sandbox_info);
+ loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded();
delete loader;
return rc;
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc
index 0ed9e15..fb3c332 100644
--- a/chrome/app/chrome_exe_main_gtk.cc
+++ b/chrome/app/chrome_exe_main_gtk.cc
@@ -4,6 +4,9 @@
#include "base/at_exit.h"
#include "base/process_util.h"
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include "chrome/browser/first_run.h"
+#endif
// The entry point for all invocations of Chromium, browser and renderer. On
// windows, this does nothing but load chrome.dll and invoke its entry point in
@@ -44,5 +47,13 @@ int main(int argc, const char** argv) {
// keep it.
// base::AtExitManager exit_manager;
- return ChromeMain(argc, argv);
+ int return_code = ChromeMain(argc, argv);
+
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ // Launch a new instance if we're shutting down because we detected an
+ // upgrade in the persistent mode.
+ Upgrade::RelaunchChromeBrowserWithNewCommandLineIfNeeded();
+#endif
+
+ return return_code;
}
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
index 074b6c8..c822ec8 100644
--- a/chrome/app/client_util.cc
+++ b/chrome/app/client_util.cc
@@ -18,6 +18,8 @@ namespace {
// The entry point signature of chrome.dll.
typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*, wchar_t*);
+typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)();
+
// Not generic, we only handle strings up to 128 chars.
bool ReadRegistryStr(HKEY key, const wchar_t* name, std::wstring* value) {
BYTE out[128 * sizeof(wchar_t)];
@@ -196,6 +198,19 @@ int MainDllLoader::Launch(HINSTANCE instance,
return OnBeforeExit(rc);
}
+void MainDllLoader::RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
+ RelaunchChromeBrowserWithNewCommandLineIfNeededFunc relaunch_function =
+ reinterpret_cast<RelaunchChromeBrowserWithNewCommandLineIfNeededFunc>(
+ ::GetProcAddress(dll_,
+ "RelaunchChromeBrowserWithNewCommandLineIfNeeded"));
+ if (!relaunch_function) {
+ LOG(ERROR) << "Could not find exported function "
+ << "RelaunchChromeBrowserWithNewCommandLineIfNeeded";
+ } else {
+ relaunch_function();
+ }
+}
+
//=============================================================================
class ChromeDllLoader : public MainDllLoader {
diff --git a/chrome/app/client_util.h b/chrome/app/client_util.h
index a391be0..8b6c154f 100644
--- a/chrome/app/client_util.h
+++ b/chrome/app/client_util.h
@@ -30,6 +30,10 @@ class MainDllLoader {
// upon termination.
int Launch(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sbox_info);
+ // Launches a new instance of the browser if the current instance in
+ // persistent mode an upgrade is detected.
+ void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
+
// Derived classes must return the relative registry path that holds the
// most current version of chrome.dll.
virtual std::wstring GetRegistryPath() = 0;