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