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

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

Issue 71013004: Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix delegate_execute for google_chrome_build 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::ProcessHandle handle; 255 base::win::ScopedHandle 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);
263 if (exit_code == installer::RENAME_SUCCESSFUL) 262 if (exit_code == installer::RENAME_SUCCESSFUL)
264 return true; 263 return true;
265 } 264 }
266 } 265 }
267 } 266 }
268 267
269 // Rename didn't work so try to rename by calling Google Update 268 // Rename didn't work so try to rename by calling Google Update
270 return InvokeGoogleUpdateForRename(); 269 return InvokeGoogleUpdateForRename();
271 } 270 }
272 271
273 bool DoUpgradeTasks(const CommandLine& command_line) { 272 bool DoUpgradeTasks(const CommandLine& command_line) {
274 // The DelegateExecute verb handler finalizes pending in-use updates for 273 // The DelegateExecute verb handler finalizes pending in-use updates for
275 // metro mode launches, as Chrome cannot be gracefully relaunched when 274 // metro mode launches, as Chrome cannot be gracefully relaunched when
276 // running in this mode. 275 // running in this mode.
277 if (base::win::IsMetroProcess()) 276 if (base::win::IsMetroProcess())
278 return false; 277 return false;
279 if (!SwapNewChromeExeIfPresent()) 278 if (!SwapNewChromeExeIfPresent())
280 return false; 279 return false;
281 // At this point the chrome.exe has been swapped with the new one. 280 // At this point the chrome.exe has been swapped with the new one.
282 if (!RelaunchChromeBrowser(command_line)) { 281 if (!RelaunchChromeBrowser(command_line)) {
283 // The re-launch fails. Feel free to panic now. 282 // The re-launch fails. Feel free to panic now.
284 NOTREACHED(); 283 NOTREACHED();
285 } 284 }
286 return true; 285 return true;
287 } 286 }
288 287
289 } // namespace upgrade_util 288 } // 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