Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/first_run/first_run.h

Issue 7655056: Enable brand codes and master preferences on the Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: expando Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 static void AutoImport( 67 static void AutoImport(
68 Profile* profile, 68 Profile* profile,
69 bool homepage_defined, 69 bool homepage_defined,
70 int import_items, 70 int import_items,
71 int dont_import_items, 71 int dont_import_items,
72 bool search_engine_experiment, 72 bool search_engine_experiment,
73 bool randomize_search_engine_experiment, 73 bool randomize_search_engine_experiment,
74 bool make_chrome_default, 74 bool make_chrome_default,
75 ProcessSingleton* process_singleton); 75 ProcessSingleton* process_singleton);
76 76
77 // Does platform specific setup. Called at the start of AutoImport.
78 static void PlatformSetup();
79
80 // Returns whether the first run should be "organic".
81 static bool IsOrganicFirstRun();
82
83 // The master preferences is a JSON file with the same entries as the 77 // The master preferences is a JSON file with the same entries as the
84 // 'Default\Preferences' file. This function locates this file from a standard 78 // 'Default\Preferences' file. This function locates this file from a standard
85 // location and processes it so it becomes the default preferences in the 79 // location and processes it so it becomes the default preferences in the
86 // profile pointed to by |user_data_dir|. After processing the file, the 80 // profile pointed to by |user_data_dir|. After processing the file, the
87 // function returns true if and only if showing the first run dialog is 81 // function returns true if and only if showing the first run dialog is
88 // needed. The detailed settings in the preference file are reported via 82 // needed. The detailed settings in the preference file are reported via
89 // |preference_details|. 83 // |preference_details|.
90 // 84 //
91 // This function destroys any existing prefs file and it is meant to be 85 // This function destroys any existing prefs file and it is meant to be
92 // invoked only on first run. 86 // invoked only on first run.
93 // 87 //
94 // See chrome/installer/util/master_preferences.h for a description of 88 // See chrome/installer/util/master_preferences.h for a description of
95 // 'master_preferences' file. 89 // 'master_preferences' file.
96 static bool ProcessMasterPreferences(const FilePath& user_data_dir, 90 static bool ProcessMasterPreferences(const FilePath& user_data_dir,
97 MasterPrefs* out_prefs); 91 MasterPrefs* out_prefs);
98 92
99 // Returns true if this is the first time chrome is run for this user. 93 // Returns true if this is the first time chrome is run for this user.
100 static bool IsChromeFirstRun(); 94 static bool IsChromeFirstRun();
101 95
102 // Creates the sentinel file that signals that chrome has been configured. 96 // Creates the sentinel file that signals that chrome has been configured.
103 static bool CreateSentinel(); 97 static bool CreateSentinel();
104 98
105 // Removes the sentinel file created in ConfigDone(). Returns false if the 99 // Removes the sentinel file created in ConfigDone(). Returns false if the
106 // sentinel file could not be removed. 100 // sentinel file could not be removed.
107 static bool RemoveSentinel(); 101 static bool RemoveSentinel();
108 102
109 // Imports settings. This may be done in a separate process depending on the
110 // platform, but it will always block until done. The return value indicates
111 // success.
112 static bool ImportSettings(Profile* profile,
113 scoped_refptr<ImporterHost> importer_host,
114 scoped_refptr<ImporterList> importer_list,
115 int items_to_import);
116
117 // Sets the kShouldShowFirstRunBubble local state pref so that the browser 103 // Sets the kShouldShowFirstRunBubble local state pref so that the browser
118 // shows the bubble once the main message loop gets going (or refrains from 104 // shows the bubble once the main message loop gets going (or refrains from
119 // showing the bubble, if |show_bubble| is false). Returns false if the pref 105 // showing the bubble, if |show_bubble| is false). Returns false if the pref
120 // could not be set. This function can be called multiple times, but only the 106 // could not be set. This function can be called multiple times, but only the
121 // initial call will actually set the preference. 107 // initial call will actually set the preference.
122 static bool SetShowFirstRunBubblePref(bool show_bubble); 108 static bool SetShowFirstRunBubblePref(bool show_bubble);
123 109
124 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the 110 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the
125 // browser shows the OEM first run bubble once the main message loop 111 // browser shows the OEM first run bubble once the main message loop
126 // gets going. Returns false if the pref could not be set. 112 // gets going. Returns false if the pref could not be set.
(...skipping 11 matching lines...) Expand all
138 124
139 // Sets the kAutofillPersonalDataManagerFirstRun local state pref so that the 125 // Sets the kAutofillPersonalDataManagerFirstRun local state pref so that the
140 // browser loads PersonalDataManager once the main message loop gets going. 126 // browser loads PersonalDataManager once the main message loop gets going.
141 // Returns false if the pref could not be set. 127 // Returns false if the pref could not be set.
142 static bool SetPersonalDataManagerFirstRunPref(); 128 static bool SetPersonalDataManagerFirstRunPref();
143 129
144 // True if special circumstances should prevent the search engine ballot from 130 // True if special circumstances should prevent the search engine ballot from
145 // being shown. 131 // being shown.
146 static bool SearchEngineSelectorDisallowed(); 132 static bool SearchEngineSelectorDisallowed();
147 133
134 // -- Platform-specific functions --
135
136 // Imports settings. This may be done in a separate process depending on the
137 // platform, but it will always block until done. The return value indicates
138 // success.
139 static bool ImportSettings(Profile* profile,
140 scoped_refptr<ImporterHost> importer_host,
141 scoped_refptr<ImporterList> importer_list,
142 int items_to_import);
143
144 // Does platform specific setup. Called at the start of AutoImport.
145 static void PlatformSetup();
146
147 // Returns whether the first run should be "organic".
148 static bool IsOrganicFirstRun();
149
150 // Returns the path for the master preferences file.
151 static FilePath MasterPrefsPath();
152
148 private: 153 private:
149 friend class FirstRunTest; 154 friend class FirstRunTest;
150 FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse); 155 FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse);
151 156
157 // Import bookmarks from an html file. The path to the file is provided in
158 // the command line.
159 static int ImportFromFile(Profile* profile, const CommandLine& cmdline);
160
161 // Gives the full path to the sentinel file. The file might not exist.
162 static bool GetFirstRunSentinelFilePath(FilePath* path);
163
164 // -- Platform-specific functions --
165
152 #if defined(OS_WIN) 166 #if defined(OS_WIN)
153 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns 167 // Writes the EULA to a temporary file, returned in |*eula_path|, and returns
154 // true if successful. 168 // true if successful.
155 static bool WriteEULAtoTempFile(FilePath* eula_path); 169 static bool WriteEULAtoTempFile(FilePath* eula_path);
156 170
157 // Launches the setup exe with the given parameter/value on the command-line, 171 // Launches the setup exe with the given parameter/value on the command-line,
158 // waits for its termination, returns its exit code in |*ret_code|, and 172 // waits for its termination, returns its exit code in |*ret_code|, and
159 // returns true if the exit code is valid. 173 // returns true if the exit code is valid.
160 static bool LaunchSetupWithParam(const std::string& param, 174 static bool LaunchSetupWithParam(const std::string& param,
161 const std::wstring& value, 175 const std::wstring& value,
162 int* ret_code); 176 int* ret_code);
163 177
164 // Installs a task to do an extensions update check once the extensions system 178 // Installs a task to do an extensions update check once the extensions system
165 // is running. 179 // is running.
166 static void DoDelayedInstallExtensions(); 180 static void DoDelayedInstallExtensions();
167 181
168 // Imports settings in a separate process. It is the implementation of the 182 // Imports settings in a separate process. It is the implementation of the
169 // public version. |skip_first_run_ui| is true if no first run UI should 183 // public version. |skip_first_run_ui| is true if no first run UI should
170 // appear (search engine dialog, Firefox import warning dialog). 184 // appear (search engine dialog, Firefox import warning dialog).
171 static bool ImportSettings(Profile* profile, 185 static bool ImportSettings(Profile* profile,
172 int importer_type, 186 int importer_type,
173 int items_to_import, 187 int items_to_import,
174 const FilePath& import_path, 188 const FilePath& import_path,
175 bool skip_first_run_ui, 189 bool skip_first_run_ui,
176 gfx::NativeView parent_window); 190 gfx::NativeView parent_window);
177 191
178 // Import browser items in this process. The browser and the items to 192 // Import browser items in this process. The browser and the items to
179 // import are encoded int the command line. 193 // import are encoded in the command line.
180 static int ImportFromBrowser(Profile* profile, const CommandLine& cmdline); 194 static int ImportFromBrowser(Profile* profile, const CommandLine& cmdline);
181 195
182 #else 196 #else
183 static bool ImportBookmarks(const FilePath& import_bookmarks_path); 197 static bool ImportBookmarks(const FilePath& import_bookmarks_path);
184 #endif 198 #endif
185 199
186 // Import bookmarks from an html file. The path to the file is provided in
187 // the command line.
188 static int ImportFromFile(Profile* profile, const CommandLine& cmdline);
189
190 // Gives the full path to the sentinel file. The file might not exist.
191 static bool GetFirstRunSentinelFilePath(FilePath* path);
192
193 enum FirstRunState { 200 enum FirstRunState {
194 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. 201 FIRST_RUN_UNKNOWN, // The state is not tested or set yet.
195 FIRST_RUN_TRUE, 202 FIRST_RUN_TRUE,
196 FIRST_RUN_FALSE 203 FIRST_RUN_FALSE
197 }; 204 };
198 205
199 // This variable should only be accessed through IsChromeFirstRun(). 206 // This variable should only be accessed through IsChromeFirstRun().
200 static FirstRunState first_run_; 207 static FirstRunState first_run_;
201 208
202 // This class is for scoping purposes. 209 // This class is for scoping purposes.
203 DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun); 210 DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun);
204 }; 211 };
205 212
206 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ 213 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698