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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 NOTREACHED(); | 129 NOTREACHED(); |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
133 // Explicitly make sure to relaunch chrome.exe rather than old_chrome.exe. | 133 // Explicitly make sure to relaunch chrome.exe rather than old_chrome.exe. |
134 // This can happen when old_chrome.exe is launched by a user. | 134 // This can happen when old_chrome.exe is launched by a user. |
135 CommandLine chrome_exe_command_line = command_line; | 135 CommandLine chrome_exe_command_line = command_line; |
136 chrome_exe_command_line.SetProgram( | 136 chrome_exe_command_line.SetProgram( |
137 chrome_exe.DirName().Append(installer::kChromeExe)); | 137 chrome_exe.DirName().Append(installer::kChromeExe)); |
138 | 138 |
139 if (base::win::GetVersion() < base::win::VERSION_WIN8) | 139 if (base::win::GetVersion() < base::win::VERSION_WIN8 && |
| 140 relaunch_mode != RELAUNCH_MODE_METRO && |
| 141 relaunch_mode != RELAUNCH_MODE_DESKTOP) |
140 return base::LaunchProcess(chrome_exe_command_line, | 142 return base::LaunchProcess(chrome_exe_command_line, |
141 base::LaunchOptions(), NULL); | 143 base::LaunchOptions(), NULL); |
142 | 144 |
143 // On Windows 8 we always use the delegate_execute for re-launching chrome. | 145 // On Windows 8 we always use the delegate_execute for re-launching chrome. |
| 146 // On Windows 7 we use delegate_execute for re-launching chrome into Windows |
| 147 // ASH. |
144 // | 148 // |
145 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- | 149 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- |
146 // activate chrome via ShellExecute which will wait until we exit. Since | 150 // activate chrome via ShellExecute which will wait until we exit. Since |
147 // ShellExecute does not support handle passing to the child process we create | 151 // ShellExecute does not support handle passing to the child process we create |
148 // a uniquely named mutex that we aquire and never release. So when we exit, | 152 // a uniquely named mutex that we aquire and never release. So when we exit, |
149 // Windows marks our mutex as abandoned and the wait is satisfied. The format | 153 // Windows marks our mutex as abandoned and the wait is satisfied. The format |
150 // of the named mutex is important. See DelegateExecuteOperation for more | 154 // of the named mutex is important. See DelegateExecuteOperation for more |
151 // details. | 155 // details. |
152 base::string16 mutex_name = | 156 base::string16 mutex_name = |
153 base::StringPrintf(L"chrome.relaunch.%d", ::GetCurrentProcessId()); | 157 base::StringPrintf(L"chrome.relaunch.%d", ::GetCurrentProcessId()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return false; | 285 return false; |
282 // At this point the chrome.exe has been swapped with the new one. | 286 // At this point the chrome.exe has been swapped with the new one. |
283 if (!RelaunchChromeBrowser(command_line)) { | 287 if (!RelaunchChromeBrowser(command_line)) { |
284 // The re-launch fails. Feel free to panic now. | 288 // The re-launch fails. Feel free to panic now. |
285 NOTREACHED(); | 289 NOTREACHED(); |
286 } | 290 } |
287 return true; | 291 return true; |
288 } | 292 } |
289 | 293 |
290 } // namespace upgrade_util | 294 } // namespace upgrade_util |
OLD | NEW |