Chromium Code Reviews| Index: chrome/browser/first_run/first_run_internal_win.cc |
| diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc |
| index 2225cc86624c52ee7e175a3c9d7a92a4cc88999f..e0f2066726b524ccfa68cb94d4da9d29b0f8f355 100644 |
| --- a/chrome/browser/first_run/first_run_internal_win.cc |
| +++ b/chrome/browser/first_run/first_run_internal_win.cc |
| @@ -145,21 +145,27 @@ void DoPostImportPlatformSpecificTasks(Profile* /* profile */) { |
| } |
| } |
| -bool GetFirstRunSentinelFilePath(base::FilePath* path) { |
| - return InstallUtil::GetSentinelFilePath( |
| - chrome::kFirstRunSentinel, BrowserDistribution::GetDistribution(), path); |
| -} |
| +bool IsFirstRunSentinelPresent() { |
| + base::FilePath sentinel; |
| + if (!GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel)) |
| + return true; |
| -bool GetLegacyFirstRunSentinelFilePath(base::FilePath* path) { |
| - // The first run sentinel for user-level installs on Windows used to |
| - // be in the application directory. |
| + // Copy any legacy first run sentinel file for Windows user-level installs |
| + // from the application directory to the user data directory. |
| base::FilePath exe_path; |
| - if (!PathService::Get(base::DIR_EXE, &exe_path) || |
| - !InstallUtil::IsPerUserInstall(exe_path.value().c_str())) { |
| - return false; |
| + if (PathService::Get(base::DIR_EXE, &exe_path) && |
| + InstallUtil::IsPerUserInstall(exe_path.value().c_str())) { |
| + base::FilePath legacy_sentinel = exe_path.Append(chrome::kFirstRunSentinel); |
| + if (base::PathExists(legacy_sentinel)) { |
| + // Copy the file instead of moving it to avoid breaking developer builds |
| + // where the sentinel is dropped beside chrome.exe by a build action. |
| + bool migrated = base::CopyFile(legacy_sentinel, sentinel); |
| + DPCHECK(migrated); |
| + return true; |
|
grt (UTC plus 2)
2014/03/27 15:35:20
please preserve this comment from first_run.cc:
//
msw
2014/03/28 00:04:11
Done.
|
| + } |
| } |
| - *path = exe_path.Append(chrome::kFirstRunSentinel); |
| - return true; |
| + |
| + return false; |
| } |
| bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { |