OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/first_run/upgrade_util.h" | 5 #include "chrome/browser/first_run/upgrade_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <psapi.h> | 8 #include <psapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 | 151 |
152 // Explicitly make sure to relaunch chrome.exe rather than old_chrome.exe. | 152 // Explicitly make sure to relaunch chrome.exe rather than old_chrome.exe. |
153 // This can happen when old_chrome.exe is launched by a user. | 153 // This can happen when old_chrome.exe is launched by a user. |
154 CommandLine chrome_exe_command_line = command_line; | 154 CommandLine chrome_exe_command_line = command_line; |
155 chrome_exe_command_line.SetProgram( | 155 chrome_exe_command_line.SetProgram( |
156 chrome_exe.DirName().Append(installer::kChromeExe)); | 156 chrome_exe.DirName().Append(installer::kChromeExe)); |
157 | 157 |
158 if (base::win::GetVersion() < base::win::VERSION_WIN8 && | 158 if (base::win::GetVersion() < base::win::VERSION_WIN8 && |
159 relaunch_mode != RELAUNCH_MODE_METRO && | 159 relaunch_mode != RELAUNCH_MODE_METRO && |
160 relaunch_mode != RELAUNCH_MODE_DESKTOP) | 160 relaunch_mode != RELAUNCH_MODE_DESKTOP) |
161 return base::LaunchProcess(chrome_exe_command_line, | 161 return base::LaunchProcess(chrome_exe_command_line, |
gab
2014/12/15 15:56:14
nit: This should be wrapped in {} since condition/
| |
162 base::LaunchOptions(), NULL); | 162 base::LaunchOptions()).IsValid(); |
163 | 163 |
164 // On Windows 8 we always use the delegate_execute for re-launching chrome. | 164 // On Windows 8 we always use the delegate_execute for re-launching chrome. |
165 // On Windows 7 we use delegate_execute for re-launching chrome into Windows | 165 // On Windows 7 we use delegate_execute for re-launching chrome into Windows |
166 // ASH. | 166 // ASH. |
167 // | 167 // |
168 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- | 168 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- |
169 // activate chrome via ShellExecute which will wait until we exit. Since | 169 // activate chrome via ShellExecute which will wait until we exit. Since |
170 // ShellExecute does not support handle passing to the child process we create | 170 // ShellExecute does not support handle passing to the child process we create |
171 // a uniquely named mutex that we aquire and never release. So when we exit, | 171 // a uniquely named mutex that we aquire and never release. So when we exit, |
172 // Windows marks our mutex as abandoned and the wait is satisfied. The format | 172 // Windows marks our mutex as abandoned and the wait is satisfied. The format |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 return false; | 303 return false; |
304 // At this point the chrome.exe has been swapped with the new one. | 304 // At this point the chrome.exe has been swapped with the new one. |
305 if (!RelaunchChromeBrowser(command_line)) { | 305 if (!RelaunchChromeBrowser(command_line)) { |
306 // The re-launch fails. Feel free to panic now. | 306 // The re-launch fails. Feel free to panic now. |
307 NOTREACHED(); | 307 NOTREACHED(); |
308 } | 308 } |
309 return true; | 309 return true; |
310 } | 310 } |
311 | 311 |
312 } // namespace upgrade_util | 312 } // namespace upgrade_util |
OLD | NEW |