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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 | 15 |
16 class CommandLine; | 16 class CommandLine; |
17 class FilePath; | |
18 class GURL; | 17 class GURL; |
19 class ImporterHost; | 18 class ImporterHost; |
20 class ImporterList; | 19 class ImporterList; |
21 class Profile; | 20 class Profile; |
22 class ProcessSingleton; | 21 class ProcessSingleton; |
23 class TemplateURLService; | 22 class TemplateURLService; |
24 | 23 |
| 24 namespace base { |
| 25 class FilePath; |
| 26 } |
| 27 |
25 namespace installer { | 28 namespace installer { |
26 class MasterPreferences; | 29 class MasterPreferences; |
27 } | 30 } |
28 | 31 |
29 namespace first_run { | 32 namespace first_run { |
30 namespace internal { | 33 namespace internal { |
31 | 34 |
32 enum FirstRunState { | 35 enum FirstRunState { |
33 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. | 36 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. |
34 FIRST_RUN_TRUE, | 37 FIRST_RUN_TRUE, |
35 FIRST_RUN_FALSE | 38 FIRST_RUN_FALSE |
36 }; | 39 }; |
37 | 40 |
38 // This variable should only be accessed through IsChromeFirstRun(). | 41 // This variable should only be accessed through IsChromeFirstRun(). |
39 extern FirstRunState first_run_; | 42 extern FirstRunState first_run_; |
40 | 43 |
41 // Loads master preferences from the master preference file into the installer | 44 // Loads master preferences from the master preference file into the installer |
42 // master preferences. Passes the master preference file path out in | 45 // master preferences. Passes the master preference file path out in |
43 // master_prefs_path. Returns the pointer to installer::MasterPreferences object | 46 // master_prefs_path. Returns the pointer to installer::MasterPreferences object |
44 // if successful; otherwise, returns NULL. | 47 // if successful; otherwise, returns NULL. |
45 installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path); | 48 installer::MasterPreferences* LoadMasterPrefs(base::FilePath* master_prefs_path)
; |
46 | 49 |
47 // Copies user preference file to master preference file. Returns true if | 50 // Copies user preference file to master preference file. Returns true if |
48 // successful. | 51 // successful. |
49 bool CopyPrefFile(const FilePath& user_data_dir, | 52 bool CopyPrefFile(const base::FilePath& user_data_dir, |
50 const FilePath& master_prefs_path); | 53 const base::FilePath& master_prefs_path); |
51 | 54 |
52 // Sets up master preferences by preferences passed by installer. | 55 // Sets up master preferences by preferences passed by installer. |
53 void SetupMasterPrefsFromInstallPrefs( | 56 void SetupMasterPrefsFromInstallPrefs( |
54 MasterPrefs* out_prefs, | 57 MasterPrefs* out_prefs, |
55 installer::MasterPreferences* install_prefs); | 58 installer::MasterPreferences* install_prefs); |
56 | 59 |
57 void SetShowWelcomePagePrefIfNeeded( | 60 void SetShowWelcomePagePrefIfNeeded( |
58 installer::MasterPreferences* install_prefs); | 61 installer::MasterPreferences* install_prefs); |
59 | 62 |
60 void SetDefaultBrowser(installer::MasterPreferences* install_prefs); | 63 void SetDefaultBrowser(installer::MasterPreferences* install_prefs); |
61 | 64 |
62 // Returns true if first run ui should be skipped, which is the case that | 65 // Returns true if first run ui should be skipped, which is the case that |
63 // skip_first_run_ui setting is set to true. In the case the setting is | 66 // skip_first_run_ui setting is set to true. In the case the setting is |
64 // not found or specified, it returns false by default. | 67 // not found or specified, it returns false by default. |
65 bool SkipFirstRunUI(installer::MasterPreferences* install_prefs); | 68 bool SkipFirstRunUI(installer::MasterPreferences* install_prefs); |
66 | 69 |
67 // Sets ping_delay. | 70 // Sets ping_delay. |
68 void SetRLZPref(first_run::MasterPrefs* out_prefs, | 71 void SetRLZPref(first_run::MasterPrefs* out_prefs, |
69 installer::MasterPreferences* install_prefs); | 72 installer::MasterPreferences* install_prefs); |
70 | 73 |
71 // -- Platform-specific functions -- | 74 // -- Platform-specific functions -- |
72 | 75 |
73 void DoPostImportPlatformSpecificTasks(); | 76 void DoPostImportPlatformSpecificTasks(); |
74 | 77 |
75 // Gives the full path to the sentinel file. The file might not exist. | 78 // Gives the full path to the sentinel file. The file might not exist. |
76 // This function has a common implementation on OS_POSIX and a windows specific | 79 // This function has a common implementation on OS_POSIX and a windows specific |
77 // implementation. | 80 // implementation. |
78 bool GetFirstRunSentinelFilePath(FilePath* path); | 81 bool GetFirstRunSentinelFilePath(base::FilePath* path); |
79 | 82 |
80 // This function has a common implementationin for all non-linux platforms, and | 83 // This function has a common implementationin for all non-linux platforms, and |
81 // a linux specific implementation. | 84 // a linux specific implementation. |
82 bool IsOrganicFirstRun(); | 85 bool IsOrganicFirstRun(); |
83 | 86 |
84 // Imports settings. This may be done in a separate process depending on the | 87 // Imports settings. This may be done in a separate process depending on the |
85 // platform, but it will always block until done. The return value indicates | 88 // platform, but it will always block until done. The return value indicates |
86 // success. | 89 // success. |
87 // This functions has a common implementation for OS_POSIX, and a | 90 // This functions has a common implementation for OS_POSIX, and a |
88 // windows specific implementation. | 91 // windows specific implementation. |
89 bool ImportSettings(Profile* profile, | 92 bool ImportSettings(Profile* profile, |
90 scoped_refptr<ImporterHost> importer_host, | 93 scoped_refptr<ImporterHost> importer_host, |
91 scoped_refptr<ImporterList> importer_list, | 94 scoped_refptr<ImporterList> importer_list, |
92 int items_to_import); | 95 int items_to_import); |
93 | 96 |
94 // Sets import preferences and launch the import process. | 97 // Sets import preferences and launch the import process. |
95 void SetImportPreferencesAndLaunchImport( | 98 void SetImportPreferencesAndLaunchImport( |
96 MasterPrefs* out_prefs, | 99 MasterPrefs* out_prefs, |
97 installer::MasterPreferences* install_prefs); | 100 installer::MasterPreferences* install_prefs); |
98 | 101 |
99 int ImportBookmarkFromFileIfNeeded(Profile* profile, | 102 int ImportBookmarkFromFileIfNeeded(Profile* profile, |
100 const CommandLine& cmdline); | 103 const CommandLine& cmdline); |
101 | 104 |
102 #if !defined(OS_WIN) | 105 #if !defined(OS_WIN) |
103 bool ImportBookmarks(const FilePath& import_bookmarks_path); | 106 bool ImportBookmarks(const base::FilePath& import_bookmarks_path); |
104 #endif | 107 #endif |
105 | 108 |
106 // Shows the EULA dialog if required. Returns true if the EULA is accepted, | 109 // Shows the EULA dialog if required. Returns true if the EULA is accepted, |
107 // returns false if the EULA has not been accepted, in which case the browser | 110 // returns false if the EULA has not been accepted, in which case the browser |
108 // should exit. | 111 // should exit. |
109 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); | 112 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); |
110 | 113 |
111 } // namespace internal | 114 } // namespace internal |
112 } // namespace first_run | 115 } // namespace first_run |
113 | 116 |
114 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ | 117 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ |
OLD | NEW |