Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: chrome/browser/first_run/upgrade_util_win.cc

Issue 90963002: Revert of Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 !cmd_version.Equals(pv_version)) { 245 !cmd_version.Equals(pv_version)) {
246 return false; 246 return false;
247 } 247 }
248 } 248 }
249 } 249 }
250 250
251 // First try to rename exe by launching rename command ourselves. 251 // First try to rename exe by launching rename command ourselves.
252 std::wstring rename_cmd; 252 std::wstring rename_cmd;
253 if (key.ReadValue(google_update::kRegRenameCmdField, 253 if (key.ReadValue(google_update::kRegRenameCmdField,
254 &rename_cmd) == ERROR_SUCCESS) { 254 &rename_cmd) == ERROR_SUCCESS) {
255 base::win::ScopedHandle handle; 255 base::ProcessHandle handle;
256 base::LaunchOptions options; 256 base::LaunchOptions options;
257 options.wait = true; 257 options.wait = true;
258 options.start_hidden = true; 258 options.start_hidden = true;
259 if (base::LaunchProcess(rename_cmd, options, &handle)) { 259 if (base::LaunchProcess(rename_cmd, options, &handle)) {
260 DWORD exit_code; 260 DWORD exit_code;
261 ::GetExitCodeProcess(handle, &exit_code); 261 ::GetExitCodeProcess(handle, &exit_code);
262 ::CloseHandle(handle);
262 if (exit_code == installer::RENAME_SUCCESSFUL) 263 if (exit_code == installer::RENAME_SUCCESSFUL)
263 return true; 264 return true;
264 } 265 }
265 } 266 }
266 } 267 }
267 268
268 // Rename didn't work so try to rename by calling Google Update 269 // Rename didn't work so try to rename by calling Google Update
269 return InvokeGoogleUpdateForRename(); 270 return InvokeGoogleUpdateForRename();
270 } 271 }
271 272
272 bool DoUpgradeTasks(const CommandLine& command_line) { 273 bool DoUpgradeTasks(const CommandLine& command_line) {
273 // The DelegateExecute verb handler finalizes pending in-use updates for 274 // The DelegateExecute verb handler finalizes pending in-use updates for
274 // metro mode launches, as Chrome cannot be gracefully relaunched when 275 // metro mode launches, as Chrome cannot be gracefully relaunched when
275 // running in this mode. 276 // running in this mode.
276 if (base::win::IsMetroProcess()) 277 if (base::win::IsMetroProcess())
277 return false; 278 return false;
278 if (!SwapNewChromeExeIfPresent()) 279 if (!SwapNewChromeExeIfPresent())
279 return false; 280 return false;
280 // At this point the chrome.exe has been swapped with the new one. 281 // At this point the chrome.exe has been swapped with the new one.
281 if (!RelaunchChromeBrowser(command_line)) { 282 if (!RelaunchChromeBrowser(command_line)) {
282 // The re-launch fails. Feel free to panic now. 283 // The re-launch fails. Feel free to panic now.
283 NOTREACHED(); 284 NOTREACHED();
284 } 285 }
285 return true; 286 return true;
286 } 287 }
287 288
288 } // namespace upgrade_util 289 } // namespace upgrade_util
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/messaging/native_process_launcher_win.cc ('k') | chrome/installer/setup/setup_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698