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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe)) 272 if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe))
273 return false; 273 return false;
274 274
275 // First try to rename exe by launching rename command ourselves. 275 // First try to rename exe by launching rename command ourselves.
276 bool user_install = 276 bool user_install =
277 InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str()); 277 InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str());
278 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; 278 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
279 BrowserDistribution *dist = BrowserDistribution::GetDistribution(); 279 BrowserDistribution *dist = BrowserDistribution::GetDistribution();
280 base::win::RegKey key; 280 base::win::RegKey key;
281 std::wstring rename_cmd; 281 std::wstring rename_cmd;
282 if (key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) && 282 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ);
283 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd)) { 283 if (result == ERROR_SUCCESS) {
284 base::ProcessHandle handle; 284 result = key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd);
285 if (base::LaunchApp(rename_cmd, true, true, &handle)) { 285 if (result == ERROR_SUCCESS) {
286 DWORD exit_code; 286 base::ProcessHandle handle;
287 ::GetExitCodeProcess(handle, &exit_code); 287 if (base::LaunchApp(rename_cmd, true, true, &handle)) {
288 ::CloseHandle(handle); 288 DWORD exit_code;
289 if (exit_code == installer::RENAME_SUCCESSFUL) 289 ::GetExitCodeProcess(handle, &exit_code);
290 return true; 290 ::CloseHandle(handle);
291 if (exit_code == installer::RENAME_SUCCESSFUL)
292 return true;
293 }
291 } 294 }
292 } 295 }
293 296
294 // Rename didn't work so try to rename by calling Google Update 297 // Rename didn't work so try to rename by calling Google Update
295 return InvokeGoogleUpdateForRename(); 298 return InvokeGoogleUpdateForRename();
296 } 299 }
297 300
298 // static 301 // static
299 bool Upgrade::DoUpgradeTasks(const CommandLine& command_line) { 302 bool Upgrade::DoUpgradeTasks(const CommandLine& command_line) {
300 if (!Upgrade::SwapNewChromeExeIfPresent()) 303 if (!Upgrade::SwapNewChromeExeIfPresent())
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 858
856 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 859 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
857 if (version > 10000) { 860 if (version > 10000) {
858 // This is a test value. We want to make sure we exercise 861 // This is a test value. We want to make sure we exercise
859 // returning this early. See EarlyReturnTest test harness. 862 // returning this early. See EarlyReturnTest test harness.
860 return Upgrade::TD_NOT_NOW; 863 return Upgrade::TD_NOT_NOW;
861 } 864 }
862 TryChromeDialog td(version); 865 TryChromeDialog td(version);
863 return td.ShowModal(); 866 return td.ShowModal();
864 } 867 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698