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

Unified Diff: chrome/browser/first_run/first_run_internal_win.cc

Issue 208393020: Fix the new First Run sentinel file path determination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify changes. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698