| OLD | NEW |
| 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 Loading... |
| 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 if ((key.Open(reg_root, dist->GetVersionKey().c_str(), |
| 282 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd)) { | 282 KEY_READ) == ERROR_SUCCESS) && |
| 283 (key.ReadValue(google_update::kRegRenameCmdField, |
| 284 &rename_cmd) == ERROR_SUCCESS)) { |
| 283 base::ProcessHandle handle; | 285 base::ProcessHandle handle; |
| 284 if (base::LaunchApp(rename_cmd, true, true, &handle)) { | 286 if (base::LaunchApp(rename_cmd, true, true, &handle)) { |
| 285 DWORD exit_code; | 287 DWORD exit_code; |
| 286 ::GetExitCodeProcess(handle, &exit_code); | 288 ::GetExitCodeProcess(handle, &exit_code); |
| 287 ::CloseHandle(handle); | 289 ::CloseHandle(handle); |
| 288 if (exit_code == installer::RENAME_SUCCESSFUL) | 290 if (exit_code == installer::RENAME_SUCCESSFUL) |
| 289 return true; | 291 return true; |
| 290 } | 292 } |
| 291 } | 293 } |
| 292 | 294 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 856 |
| 855 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { | 857 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { |
| 856 if (version > 10000) { | 858 if (version > 10000) { |
| 857 // This is a test value. We want to make sure we exercise | 859 // This is a test value. We want to make sure we exercise |
| 858 // returning this early. See EarlyReturnTest test harness. | 860 // returning this early. See EarlyReturnTest test harness. |
| 859 return Upgrade::TD_NOT_NOW; | 861 return Upgrade::TD_NOT_NOW; |
| 860 } | 862 } |
| 861 TryChromeDialog td(version); | 863 TryChromeDialog td(version); |
| 862 return td.ShowModal(); | 864 return td.ShowModal(); |
| 863 } | 865 } |
| OLD | NEW |