| 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 5d94bcb06a066ae31340b4e95583c13afc7a3744..629e9520d963d9776cbf44c6c0f8026a6b43ab4c 100644
|
| --- a/chrome/browser/first_run/first_run.cc
|
| +++ b/chrome/browser/first_run/first_run.cc
|
| @@ -89,6 +89,11 @@ uint16_t g_auto_import_state = first_run::AUTO_IMPORT_NONE;
|
| bool g_should_show_welcome_page = false;
|
| bool g_should_do_autofill_personal_data_manager_first_run = false;
|
|
|
| +// Indicates whether this is first run. Populated when IsChromeFirstRun
|
| +// is invoked, then used as a cache on subsequent calls.
|
| +first_run::internal::FirstRunState g_first_run =
|
| + first_run::internal::FIRST_RUN_UNKNOWN;
|
| +
|
| // This class acts as an observer for the ImporterProgressObserver::ImportEnded
|
| // callback. When the import process is started, certain errors may cause
|
| // ImportEnded() to be called synchronously, but the typical case is that
|
| @@ -495,8 +500,6 @@ void ProcessDefaultBrowserPolicy(bool make_chrome_default_for_user) {
|
| namespace first_run {
|
| namespace internal {
|
|
|
| -FirstRunState g_first_run = FIRST_RUN_UNKNOWN;
|
| -
|
| void SetupMasterPrefsFromInstallPrefs(
|
| const installer::MasterPreferences& install_prefs,
|
| MasterPrefs* out_prefs) {
|
| @@ -617,6 +620,14 @@ bool IsOrganicFirstRun() {
|
| }
|
| #endif
|
|
|
| +FirstRunState DetermineFirstRunState(bool has_sentinel,
|
| + bool force_first_run,
|
| + bool no_first_run) {
|
| + return (force_first_run || (!has_sentinel && !no_first_run))
|
| + ? FIRST_RUN_TRUE
|
| + : FIRST_RUN_FALSE;
|
| +}
|
| +
|
| } // namespace internal
|
|
|
| MasterPrefs::MasterPrefs()
|
| @@ -632,17 +643,15 @@ MasterPrefs::MasterPrefs()
|
| MasterPrefs::~MasterPrefs() {}
|
|
|
| bool IsChromeFirstRun() {
|
| - if (internal::g_first_run == internal::FIRST_RUN_UNKNOWN) {
|
| - internal::g_first_run = internal::FIRST_RUN_FALSE;
|
| + if (g_first_run == internal::FIRST_RUN_UNKNOWN) {
|
| const base::CommandLine* command_line =
|
| base::CommandLine::ForCurrentProcess();
|
| - if (command_line->HasSwitch(switches::kForceFirstRun) ||
|
| - (!command_line->HasSwitch(switches::kNoFirstRun) &&
|
| - !internal::IsFirstRunSentinelPresent())) {
|
| - internal::g_first_run = internal::FIRST_RUN_TRUE;
|
| - }
|
| + g_first_run = internal::DetermineFirstRunState(
|
| + internal::IsFirstRunSentinelPresent(),
|
| + command_line->HasSwitch(switches::kForceFirstRun),
|
| + command_line->HasSwitch(switches::kNoFirstRun));
|
| }
|
| - return internal::g_first_run == internal::FIRST_RUN_TRUE;
|
| + return g_first_run == internal::FIRST_RUN_TRUE;
|
| }
|
|
|
| #if defined(OS_MACOSX)
|
|
|