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

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

Powered by Google App Engine
This is Rietveld 408576698