Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / first_run / first_run.h
blob9faf6f294713c39d262c7ae8e96b93240cf20416
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file contains the iOS equivalent of FirstRun.
7 #ifndef IOS_CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
8 #define IOS_CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
10 #include "base/basictypes.h"
12 namespace base {
13 class FilePath;
16 namespace user_prefs {
17 class PrefRegistrySyncable;
20 // A collection of functions to manage the user experience when running
21 // this application for the first time. The iOS implementation is significantly
22 // simpler than other platforms because it is designed to be preemptive and
23 // stops user from doing anything else until the First Run UX is completed
24 // or explicitly skipped.
25 class FirstRun {
26 public:
27 // Returns true if this is the first time chrome is run for this user.
28 static bool IsChromeFirstRun();
30 // Creates the sentinel file that signals that chrome has been configured iff
31 // the file does not exist yet. Returns true if the file was created and false
32 // if the file already exists or could not be created.
33 static bool CreateSentinel();
35 // Removes the sentinel file created in ConfigDone(). Returns false if the
36 // sentinel file could not be removed.
37 static bool RemoveSentinel();
39 // Get RLZ ping delay pref name.
40 static const char* GetPingDelayPrefName();
42 // Register user preferences.
43 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
45 private:
46 // Gives the full path to the sentinel file. The file might not exist.
47 static bool GetFirstRunSentinelFilePath(base::FilePath* path);
49 enum FirstRunState {
50 FIRST_RUN_UNKNOWN, // The state is not tested or set yet.
51 FIRST_RUN_TRUE,
52 FIRST_RUN_FALSE
55 // This variable should only be accessed through IsChromeFirstRun().
56 static FirstRunState first_run_;
58 DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun);
61 #endif // IOS_CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_