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

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

Issue 12670013: Out-of-process import on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep Google Toolbar import in-process. Created 7 years, 7 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
OLDNEW
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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 // fully test the custom installer. It also contains the opposite actions to 29 // fully test the custom installer. It also contains the opposite actions to
30 // execute during uninstall. When the first run UI is ready we won't 30 // execute during uninstall. When the first run UI is ready we won't
31 // do the actions unconditionally. Currently the only action is to create a 31 // do the actions unconditionally. Currently the only action is to create a
32 // desktop shortcut. 32 // desktop shortcut.
33 // 33 //
34 // The way we detect first-run is by looking at a 'sentinel' file. 34 // The way we detect first-run is by looking at a 'sentinel' file.
35 // If it does not exist we understand that we need to do the first time 35 // If it does not exist we understand that we need to do the first time
36 // install work for this user. After that the sentinel file is created. 36 // install work for this user. After that the sentinel file is created.
37 namespace first_run { 37 namespace first_run {
38 38
39 enum AutoImportState {
40 AUTO_IMPORT_NONE = 0,
41 AUTO_IMPORT_CALLED = 1 << 0,
42 AUTO_IMPORT_PROFILE_IMPORTED = 1 << 1,
43 AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED = 1 << 2,
44 };
45
39 enum FirstRunBubbleMetric { 46 enum FirstRunBubbleMetric {
40 FIRST_RUN_BUBBLE_SHOWN = 0, // The search engine bubble was shown. 47 FIRST_RUN_BUBBLE_SHOWN = 0, // The search engine bubble was shown.
41 FIRST_RUN_BUBBLE_CHANGE_INVOKED, // The bubble's "Change" was invoked. 48 FIRST_RUN_BUBBLE_CHANGE_INVOKED, // The bubble's "Change" was invoked.
42 NUM_FIRST_RUN_BUBBLE_METRICS 49 NUM_FIRST_RUN_BUBBLE_METRICS
43 }; 50 };
44 51
45 // Options for the first run bubble. The default is FIRST_RUN_BUBBLE_DONT_SHOW. 52 // Options for the first run bubble. The default is FIRST_RUN_BUBBLE_DONT_SHOW.
46 // FIRST_RUN_BUBBLE_SUPPRESS is stronger in that FIRST_RUN_BUBBLE_SHOW should 53 // FIRST_RUN_BUBBLE_SUPPRESS is stronger in that FIRST_RUN_BUBBLE_SHOW should
47 // never be set once FIRST_RUN_BUBBLE_SUPPRESS is set. 54 // never be set once FIRST_RUN_BUBBLE_SUPPRESS is set.
48 enum FirstRunBubbleOptions { 55 enum FirstRunBubbleOptions {
(...skipping 18 matching lines...) Expand all
67 // dumped into local_state. Also see related TODO in chrome_browser_main.cc. 74 // dumped into local_state. Also see related TODO in chrome_browser_main.cc.
68 75
69 int ping_delay; 76 int ping_delay;
70 bool homepage_defined; 77 bool homepage_defined;
71 int do_import_items; 78 int do_import_items;
72 int dont_import_items; 79 int dont_import_items;
73 bool make_chrome_default; 80 bool make_chrome_default;
74 bool suppress_first_run_default_browser_prompt; 81 bool suppress_first_run_default_browser_prompt;
75 std::vector<GURL> new_tabs; 82 std::vector<GURL> new_tabs;
76 std::vector<GURL> bookmarks; 83 std::vector<GURL> bookmarks;
84 std::string import_bookmarks_path;
77 std::string variations_seed; 85 std::string variations_seed;
78 std::string suppress_default_browser_prompt_for_version; 86 std::string suppress_default_browser_prompt_for_version;
79 }; 87 };
80 88
81 // Returns true if this is the first time chrome is run for this user. 89 // Returns true if this is the first time chrome is run for this user.
82 bool IsChromeFirstRun(); 90 bool IsChromeFirstRun();
83 91
84 // Creates the sentinel file that signals that chrome has been configured. 92 // Creates the sentinel file that signals that chrome has been configured.
85 bool CreateSentinel(); 93 bool CreateSentinel();
86 94
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Returns true if the autofill personal data manager first-run action 128 // Returns true if the autofill personal data manager first-run action
121 // should be taken. 129 // should be taken.
122 // 130 //
123 // This will return true only once, the first time it is called after 131 // This will return true only once, the first time it is called after
124 // SetShouldDoPersonalDataManagerFirstRun() is called. 132 // SetShouldDoPersonalDataManagerFirstRun() is called.
125 bool ShouldDoPersonalDataManagerFirstRun(); 133 bool ShouldDoPersonalDataManagerFirstRun();
126 134
127 // Log a metric for the "FirstRun.SearchEngineBubble" histogram. 135 // Log a metric for the "FirstRun.SearchEngineBubble" histogram.
128 void LogFirstRunMetric(FirstRunBubbleMetric metric); 136 void LogFirstRunMetric(FirstRunBubbleMetric metric);
129 137
130 // Allow a test to specify additional arguments for the profile import process.
131 void SetExtraArgumentsForImportProcess(const CommandLine& arguments);
132
133 // Get any extra arguments set with SetExtraArgumentsForImportProcess.
134 const CommandLine& GetExtraArgumentsForImportProcess();
135
136 // -- Platform-specific functions --
137
138 // Automatically import history and home page (and search engine, if 138 // Automatically import history and home page (and search engine, if
139 // ShouldShowSearchEngineDialog is true). 139 // ShouldShowSearchEngineDialog is true). Also imports bookmarks from file if
140 // |import_bookmarks_path| is not empty.
140 void AutoImport(Profile* profile, 141 void AutoImport(Profile* profile,
141 bool homepage_defined, 142 bool homepage_defined,
142 int import_items, 143 int import_items,
143 int dont_import_items); 144 int dont_import_items,
145 const std::string& import_bookmarks_path);
144 146
145 // Does remaining first run tasks for |profile| and makes Chrome default browser 147 // Does remaining first run tasks for |profile| and makes Chrome default browser
146 // if |make_chrome_default|. This can pop the first run consent dialog on linux. 148 // if |make_chrome_default|. This can pop the first run consent dialog on linux.
147 void DoPostImportTasks(Profile* profile, bool make_chrome_default); 149 void DoPostImportTasks(Profile* profile, bool make_chrome_default);
148 150
149 // Whether a first-run import was triggered before the browser mainloop began. 151 // Returns the current state of AutoImport as recorded in a bitfield formed from
150 // This is used in testing to verify import startup actions that occur before 152 // values in AutoImportState.
151 // an observer can be registered in the test. 153 uint16 auto_import_state();
152 bool DidPerformProfileImport(bool* exited_successfully);
153
154 // Imports bookmarks and/or browser items (depending on platform support)
155 // in this process. This function is paired with first_run::ImportSettings().
156 // This function might or might not show a visible UI depending on the
157 // cmdline parameters.
158 int ImportNow(Profile* profile, const CommandLine& cmdline);
159 154
160 // Set a master preferences file path that overrides platform defaults. 155 // Set a master preferences file path that overrides platform defaults.
161 void SetMasterPrefsPathForTesting(const base::FilePath& master_prefs); 156 void SetMasterPrefsPathForTesting(const base::FilePath& master_prefs);
162 157
163 // The master preferences is a JSON file with the same entries as the 158 // The master preferences is a JSON file with the same entries as the
164 // 'Default\Preferences' file. This function locates this file from a standard 159 // 'Default\Preferences' file. This function locates this file from a standard
165 // location and processes it so it becomes the default preferences in the 160 // location and processes it so it becomes the default preferences in the
166 // profile pointed to by |user_data_dir|. After processing the file, the 161 // profile pointed to by |user_data_dir|. After processing the file, the
167 // function returns a value from the ProcessMasterPreferencesResult enum, 162 // function returns a value from the ProcessMasterPreferencesResult enum,
168 // indicating whether the first run flow should be shown, skipped, or whether 163 // indicating whether the first run flow should be shown, skipped, or whether
(...skipping 26 matching lines...) Expand all
195 const content::NotificationDetails& details) OVERRIDE; 190 const content::NotificationDetails& details) OVERRIDE;
196 191
197 content::NotificationRegistrar registrar_; 192 content::NotificationRegistrar registrar_;
198 193
199 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); 194 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher);
200 }; 195 };
201 196
202 } // namespace first_run 197 } // namespace first_run
203 198
204 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ 199 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698