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_H_ | 5 #ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
6 #define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 6 #define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Sets the kShouldShowWelcomePage local state pref so that the browser | 63 // Sets the kShouldShowWelcomePage local state pref so that the browser |
64 // loads the welcome tab once the message loop gets going. Returns false | 64 // loads the welcome tab once the message loop gets going. Returns false |
65 // if the pref could not be set. | 65 // if the pref could not be set. |
66 bool SetShowWelcomePagePref(); | 66 bool SetShowWelcomePagePref(); |
67 | 67 |
68 // Sets the kAutofillPersonalDataManagerFirstRun local state pref so that the | 68 // Sets the kAutofillPersonalDataManagerFirstRun local state pref so that the |
69 // browser loads PersonalDataManager once the main message loop gets going. | 69 // browser loads PersonalDataManager once the main message loop gets going. |
70 // Returns false if the pref could not be set. | 70 // Returns false if the pref could not be set. |
71 bool SetPersonalDataManagerFirstRunPref(); | 71 bool SetPersonalDataManagerFirstRunPref(); |
72 | 72 |
| 73 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the |
| 74 // browser shows the OEM first run bubble once the main message loop |
| 75 // gets going. Returns false if the pref could not be set. |
| 76 bool SetOEMFirstRunBubblePref(); |
| 77 |
| 78 // Whether the search engine selection dialog should be shown on first run. |
| 79 bool ShouldShowSearchEngineSelector(const TemplateURLService* model); |
| 80 |
73 // -- Platform-specific functions -- | 81 // -- Platform-specific functions -- |
74 | 82 |
75 // Automatically import history and home page (and search engine, if | 83 // Automatically import history and home page (and search engine, if |
76 // ShouldShowSearchEngineDialog is true). | 84 // ShouldShowSearchEngineDialog is true). |
77 void AutoImport(Profile* profile, | 85 void AutoImport(Profile* profile, |
78 bool homepage_defined, | 86 bool homepage_defined, |
79 int import_items, | 87 int import_items, |
80 int dont_import_items, | 88 int dont_import_items, |
81 bool search_engine_experiment, | 89 bool search_engine_experiment, |
82 bool randomize_search_engine_experiment, | 90 bool randomize_search_engine_experiment, |
83 bool make_chrome_default, | 91 bool make_chrome_default, |
84 ProcessSingleton* process_singleton); | 92 ProcessSingleton* process_singleton); |
85 | 93 |
86 // Imports bookmarks and/or browser items (depending on platform support) | 94 // Imports bookmarks and/or browser items (depending on platform support) |
87 // in this process. This function is paired with first_run::ImportSettings(). | 95 // in this process. This function is paired with first_run::ImportSettings(). |
88 // This function might or might not show a visible UI depending on the | 96 // This function might or might not show a visible UI depending on the |
89 // cmdline parameters. | 97 // cmdline parameters. |
90 int ImportNow(Profile* profile, const CommandLine& cmdline); | 98 int ImportNow(Profile* profile, const CommandLine& cmdline); |
91 | 99 |
| 100 // Returns the path for the master preferences file. |
| 101 FilePath MasterPrefsPath(); |
| 102 |
92 } // namespace first_run | 103 } // namespace first_run |
93 | 104 |
94 // This class contains the chrome first-run installation actions needed to | 105 // This class contains the chrome first-run installation actions needed to |
95 // fully test the custom installer. It also contains the opposite actions to | 106 // fully test the custom installer. It also contains the opposite actions to |
96 // execute during uninstall. When the first run UI is ready we won't | 107 // execute during uninstall. When the first run UI is ready we won't |
97 // do the actions unconditionally. Currently the only action is to create a | 108 // do the actions unconditionally. Currently the only action is to create a |
98 // desktop shortcut. | 109 // desktop shortcut. |
99 // | 110 // |
100 // The way we detect first-run is by looking at a 'sentinel' file. | 111 // The way we detect first-run is by looking at a 'sentinel' file. |
101 // If it does not exist we understand that we need to do the first time | 112 // If it does not exist we understand that we need to do the first time |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // |preference_details|. | 145 // |preference_details|. |
135 // | 146 // |
136 // This function destroys any existing prefs file and it is meant to be | 147 // This function destroys any existing prefs file and it is meant to be |
137 // invoked only on first run. | 148 // invoked only on first run. |
138 // | 149 // |
139 // See chrome/installer/util/master_preferences.h for a description of | 150 // See chrome/installer/util/master_preferences.h for a description of |
140 // 'master_preferences' file. | 151 // 'master_preferences' file. |
141 static bool ProcessMasterPreferences(const FilePath& user_data_dir, | 152 static bool ProcessMasterPreferences(const FilePath& user_data_dir, |
142 MasterPrefs* out_prefs); | 153 MasterPrefs* out_prefs); |
143 | 154 |
144 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the | |
145 // browser shows the OEM first run bubble once the main message loop | |
146 // gets going. Returns false if the pref could not be set. | |
147 static bool SetOEMFirstRunBubblePref(); | |
148 | |
149 // Whether the search engine selection dialog should be shown on first run. | |
150 static bool ShouldShowSearchEngineSelector(const TemplateURLService* model); | |
151 | |
152 // -- Platform-specific functions -- | |
153 | |
154 // Returns the path for the master preferences file. | |
155 static FilePath MasterPrefsPath(); | |
156 | |
157 private: | 155 private: |
158 friend class FirstRunTest; | 156 friend class FirstRunTest; |
159 FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse); | 157 FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse); |
160 | 158 |
161 // -- Platform-specific functions -- | 159 // -- Platform-specific functions -- |
162 | 160 |
163 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
164 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns | 162 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns |
165 // true if successful. | 163 // true if successful. |
166 static bool WriteEULAtoTempFile(FilePath* eula_path); | 164 static bool WriteEULAtoTempFile(FilePath* eula_path); |
167 | 165 |
168 // Launches the setup exe with the given parameter/value on the command-line, | 166 // Launches the setup exe with the given parameter/value on the command-line, |
169 // waits for its termination, returns its exit code in |*ret_code|, and | 167 // waits for its termination, returns its exit code in |*ret_code|, and |
170 // returns true if the exit code is valid. | 168 // returns true if the exit code is valid. |
171 static bool LaunchSetupWithParam(const std::string& param, | 169 static bool LaunchSetupWithParam(const std::string& param, |
172 const std::wstring& value, | 170 const std::wstring& value, |
173 int* ret_code); | 171 int* ret_code); |
174 | 172 |
175 // Installs a task to do an extensions update check once the extensions system | 173 // Installs a task to do an extensions update check once the extensions system |
176 // is running. | 174 // is running. |
177 static void DoDelayedInstallExtensions(); | 175 static void DoDelayedInstallExtensions(); |
178 | 176 |
179 #endif | 177 #endif |
180 | 178 |
181 // This class is for scoping purposes. | 179 // This class is for scoping purposes. |
182 DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun); | 180 DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun); |
183 }; | 181 }; |
184 | 182 |
185 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 183 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
OLD | NEW |