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

Side by Side Diff: chrome/browser/first_run/first_run.cc

Issue 21150006: Introduce --cancel-first-run and reduce the strength of --no-first-run. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: --skip-first-run => --no-first-run Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 bool IsChromeFirstRun() { 591 bool IsChromeFirstRun() {
592 if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN) 592 if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN)
593 return internal::first_run_ == internal::FIRST_RUN_TRUE; 593 return internal::first_run_ == internal::FIRST_RUN_TRUE;
594 594
595 internal::first_run_ = internal::FIRST_RUN_FALSE; 595 internal::first_run_ = internal::FIRST_RUN_FALSE;
596 596
597 base::FilePath first_run_sentinel; 597 base::FilePath first_run_sentinel;
598 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 598 const CommandLine* command_line = CommandLine::ForCurrentProcess();
599 if (command_line->HasSwitch(switches::kForceFirstRun)) { 599 if (command_line->HasSwitch(switches::kForceFirstRun)) {
600 internal::first_run_ = internal::FIRST_RUN_TRUE; 600 internal::first_run_ = internal::FIRST_RUN_TRUE;
601 } else if (command_line->HasSwitch(switches::kNoFirstRun)) { 601 } else if (command_line->HasSwitch(switches::kCancelFirstRun)) {
602 internal::first_run_ = internal::FIRST_RUN_CANCEL; 602 internal::first_run_ = internal::FIRST_RUN_CANCEL;
603 } else if (internal::GetFirstRunSentinelFilePath(&first_run_sentinel) && 603 } else if (!command_line->HasSwitch(switches::kNoFirstRun) &&
604 internal::GetFirstRunSentinelFilePath(&first_run_sentinel) &&
604 !base::PathExists(first_run_sentinel)) { 605 !base::PathExists(first_run_sentinel)) {
605 internal::first_run_ = internal::FIRST_RUN_TRUE; 606 internal::first_run_ = internal::FIRST_RUN_TRUE;
606 } 607 }
607 608
608 return internal::first_run_ == internal::FIRST_RUN_TRUE; 609 return internal::first_run_ == internal::FIRST_RUN_TRUE;
609 } 610 }
610 611
612 bool IsFirstRunSuppressed(const CommandLine& command_line) {
613 return command_line.HasSwitch(switches::kCancelFirstRun) ||
614 command_line.HasSwitch(switches::kNoFirstRun);
615 }
616
611 void CreateSentinelIfNeeded() { 617 void CreateSentinelIfNeeded() {
612 if (IsChromeFirstRun() || 618 if (IsChromeFirstRun() ||
613 internal::first_run_ == internal::FIRST_RUN_CANCEL) { 619 internal::first_run_ == internal::FIRST_RUN_CANCEL) {
614 internal::CreateSentinel(); 620 internal::CreateSentinel();
615 } 621 }
616 } 622 }
617 623
618 std::string GetPingDelayPrefName() { 624 std::string GetPingDelayPrefName() {
619 return base::StringPrintf("%s.%s", 625 return base::StringPrintf("%s.%s",
620 installer::master_preferences::kDistroDict, 626 installer::master_preferences::kDistroDict,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 SetShouldDoPersonalDataManagerFirstRun(); 816 SetShouldDoPersonalDataManagerFirstRun();
811 817
812 internal::DoPostImportPlatformSpecificTasks(profile); 818 internal::DoPostImportPlatformSpecificTasks(profile);
813 } 819 }
814 820
815 uint16 auto_import_state() { 821 uint16 auto_import_state() {
816 return g_auto_import_state; 822 return g_auto_import_state;
817 } 823 }
818 824
819 } // namespace first_run 825 } // namespace first_run
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698