first_run_internal.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
6#define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
7
8class MasterPrefs;
9class Profile;
10
11namespace base {
12class FilePath;
13}
14
15namespace installer {
16class MasterPreferences;
17}
18
19namespace first_run {
20
21namespace internal {
22
23enum FirstRunState {
24  FIRST_RUN_UNKNOWN,  // The state is not tested or set yet.
25  FIRST_RUN_TRUE,
26  FIRST_RUN_FALSE,
27  FIRST_RUN_CANCEL,  // This shouldn't be considered first run but the sentinel
28                     // should be created anyways.
29};
30
31// This variable should only be accessed through IsChromeFirstRun().
32extern FirstRunState first_run_;
33
34// Sets up master preferences by preferences passed by installer.
35void SetupMasterPrefsFromInstallPrefs(
36    const installer::MasterPreferences& install_prefs,
37    MasterPrefs* out_prefs);
38
39// Creates the sentinel file that signals that chrome has been configured.
40bool CreateSentinel();
41
42// -- Platform-specific functions --
43
44void DoPostImportPlatformSpecificTasks(Profile* profile);
45
46// Gives the full path to the sentinel file. The file might not exist.
47// This function has a common implementation on OS_POSIX and a windows specific
48// implementation.
49bool GetFirstRunSentinelFilePath(base::FilePath* path);
50
51// This function has a common implementationin for all non-linux platforms, and
52// a linux specific implementation.
53bool IsOrganicFirstRun();
54
55// Shows the EULA dialog if required. Returns true if the EULA is accepted,
56// returns false if the EULA has not been accepted, in which case the browser
57// should exit.
58bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs);
59
60// Returns the path for the master preferences file.
61base::FilePath MasterPrefsPath();
62
63}  // namespace internal
64}  // namespace first_run
65
66#endif  // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
67