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

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

Powered by Google App Engine
This is Rietveld 408576698