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

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

Issue 20483002: Merge 3 different ways of obtaining first run state into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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.cc
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 315d6f9e37b24611d7da24494eed530885bacca0..585ba2ca6ae7b16f4b1868044294da7d97663882 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -469,14 +469,35 @@ bool IsChromeFirstRun() {
if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN)
return internal::first_run_ == internal::FIRST_RUN_TRUE;
+ enum FirstRunState {
+ CANCEL_FIRST_RUN,
+ NOT_FIRST_RUN,
+ IS_FIRST_RUN,
+ };
+
+ FirstRunState first_run_state = NOT_FIRST_RUN;
+
base::FilePath first_run_sentinel;
- if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel) ||
- base::PathExists(first_run_sentinel)) {
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kForceFirstRun)) {
+ first_run_state = IS_FIRST_RUN;
+ } else if (command_line->HasSwitch(switches::kNoFirstRun)) {
+ first_run_state = CANCEL_FIRST_RUN;
+ } else if (internal::GetFirstRunSentinelFilePath(&first_run_sentinel) &&
+ !base::PathExists(first_run_sentinel)) {
+ first_run_state = IS_FIRST_RUN;
+ }
+
+ if (first_run_state == IS_FIRST_RUN || first_run_state == CANCEL_FIRST_RUN)
+ CreateSentinel();
cpu_(ooo_6.6-7.5) 2013/07/27 21:16:31 yeah it would be ideal if we don't create the sent
gab 2013/07/29 17:39:50 It always has, but I agree that it would make sens
+
+ if (first_run_state == IS_FIRST_RUN) {
+ internal::first_run_ = internal::FIRST_RUN_TRUE;
+ return true;
+ } else {
internal::first_run_ = internal::FIRST_RUN_FALSE;
return false;
}
- internal::first_run_ = internal::FIRST_RUN_TRUE;
- return true;
}
bool CreateSentinel() {
@@ -636,13 +657,6 @@ ProcessMasterPreferencesResult ProcessMasterPreferences(
MasterPrefs* out_prefs) {
DCHECK(!user_data_dir.empty());
-#if defined(OS_CHROMEOS)
- // Chrome OS has its own out-of-box-experience code. Create the sentinel to
- // mark the fact that we've run once but skip the full first-run flow.
- CreateSentinel();
- return SKIP_FIRST_RUN_TASKS;
-#endif
-
base::FilePath master_prefs_path;
scoped_ptr<installer::MasterPreferences>
install_prefs(internal::LoadMasterPrefs(&master_prefs_path));
@@ -664,7 +678,7 @@ ProcessMasterPreferencesResult ProcessMasterPreferences(
internal::SetDefaultBrowser(install_prefs.get());
}
- return DO_FIRST_RUN_TASKS;
+ return FIRST_RUN_PROCEED;
}
void AutoImport(

Powered by Google App Engine
This is Rietveld 408576698