diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 22:39:58 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 22:39:58 +0000 |
commit | c4334a4b0cd6b1b11b115251d8859a502a22d6db (patch) | |
tree | 082b21a77e42b7f16185ef3031254a6633c62ef1 /chrome/browser/first_run.cc | |
parent | 603c1d0ce8f84241739005df226f5e31494dd3cd (diff) | |
download | chromium_src-c4334a4b0cd6b1b11b115251d8859a502a22d6db.zip chromium_src-c4334a4b0cd6b1b11b115251d8859a502a22d6db.tar.gz chromium_src-c4334a4b0cd6b1b11b115251d8859a502a22d6db.tar.bz2 |
* Try to rename chrome exes in shutdown path as well.
BUG=1463346
Review URL: http://codereview.chromium.org/10805
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5313 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run.cc')
-rwxr-xr-x[-rw-r--r--] | chrome/browser/first_run.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc index de08f40..3e82aa0 100644..100755 --- a/chrome/browser/first_run.cc +++ b/chrome/browser/first_run.cc @@ -190,6 +190,26 @@ bool FirstRun::ProcessMasterPreferences( return false; } +bool Upgrade::IsBrowserAlreadyRunning() { + static HANDLE handle = NULL; + std::wstring exe; + PathService::Get(base::FILE_EXE, &exe); + std::replace(exe.begin(), exe.end(), '\\', '!'); + std::transform(exe.begin(), exe.end(), exe.begin(), tolower); + exe = L"Global\\" + exe; + if (handle != NULL) + CloseHandle(handle); + handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str()); + int error = GetLastError(); + return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED); +} + +bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) { + ::SetEnvironmentVariable(google_update::kEnvProductVersionKey, NULL); + return process_util::LaunchApp(command_line.command_line_string(), + false, false, NULL); +} + bool Upgrade::SwapNewChromeExeIfPresent() { std::wstring new_chrome_exe; if (!GetNewerChromeFile(&new_chrome_exe)) @@ -226,12 +246,6 @@ bool Upgrade::SwapNewChromeExeIfPresent() { return false; } -bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) { - ::SetEnvironmentVariable(google_update::kEnvProductVersionKey, NULL); - return process_util::LaunchApp(command_line.command_line_string(), - false, false, NULL); -} - void OpenFirstRunDialog(Profile* profile) { views::Window::CreateChromeWindow(NULL, gfx::Rect(), new FirstRunView(profile))->Show(); |