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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 | 18 |
19 class CommandLine; | 19 class CommandLine; |
20 class FilePath; | |
21 class GURL; | 20 class GURL; |
22 class PrefServiceSyncable; | 21 class PrefServiceSyncable; |
23 class Profile; | 22 class Profile; |
24 class ProcessSingleton; | 23 class ProcessSingleton; |
25 | 24 |
| 25 namespace base { |
| 26 class FilePath; |
| 27 } |
| 28 |
26 // This namespace contains the chrome first-run installation actions needed to | 29 // This namespace contains the chrome first-run installation actions needed to |
27 // fully test the custom installer. It also contains the opposite actions to | 30 // fully test the custom installer. It also contains the opposite actions to |
28 // execute during uninstall. When the first run UI is ready we won't | 31 // execute during uninstall. When the first run UI is ready we won't |
29 // do the actions unconditionally. Currently the only action is to create a | 32 // do the actions unconditionally. Currently the only action is to create a |
30 // desktop shortcut. | 33 // desktop shortcut. |
31 // | 34 // |
32 // The way we detect first-run is by looking at a 'sentinel' file. | 35 // The way we detect first-run is by looking at a 'sentinel' file. |
33 // If it does not exist we understand that we need to do the first time | 36 // If it does not exist we understand that we need to do the first time |
34 // install work for this user. After that the sentinel file is created. | 37 // install work for this user. After that the sentinel file is created. |
35 namespace first_run { | 38 namespace first_run { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // if |make_chrome_default|. This can pop the first run consent dialog on linux. | 129 // if |make_chrome_default|. This can pop the first run consent dialog on linux. |
127 void DoPostImportTasks(Profile* profile, bool make_chrome_default); | 130 void DoPostImportTasks(Profile* profile, bool make_chrome_default); |
128 | 131 |
129 // Imports bookmarks and/or browser items (depending on platform support) | 132 // Imports bookmarks and/or browser items (depending on platform support) |
130 // in this process. This function is paired with first_run::ImportSettings(). | 133 // in this process. This function is paired with first_run::ImportSettings(). |
131 // This function might or might not show a visible UI depending on the | 134 // This function might or might not show a visible UI depending on the |
132 // cmdline parameters. | 135 // cmdline parameters. |
133 int ImportNow(Profile* profile, const CommandLine& cmdline); | 136 int ImportNow(Profile* profile, const CommandLine& cmdline); |
134 | 137 |
135 // Returns the path for the master preferences file. | 138 // Returns the path for the master preferences file. |
136 FilePath MasterPrefsPath(); | 139 base::FilePath MasterPrefsPath(); |
137 | 140 |
138 // Set a master preferences file path that overrides platform defaults. | 141 // Set a master preferences file path that overrides platform defaults. |
139 void SetMasterPrefsPathForTesting(const FilePath& master_prefs); | 142 void SetMasterPrefsPathForTesting(const base::FilePath& master_prefs); |
140 | 143 |
141 // The master preferences is a JSON file with the same entries as the | 144 // The master preferences is a JSON file with the same entries as the |
142 // 'Default\Preferences' file. This function locates this file from a standard | 145 // 'Default\Preferences' file. This function locates this file from a standard |
143 // location and processes it so it becomes the default preferences in the | 146 // location and processes it so it becomes the default preferences in the |
144 // profile pointed to by |user_data_dir|. After processing the file, the | 147 // profile pointed to by |user_data_dir|. After processing the file, the |
145 // function returns a value from the ProcessMasterPreferencesResult enum, | 148 // function returns a value from the ProcessMasterPreferencesResult enum, |
146 // indicating whether the first run flow should be shown, skipped, or whether | 149 // indicating whether the first run flow should be shown, skipped, or whether |
147 // the browser should exit. | 150 // the browser should exit. |
148 // | 151 // |
149 // This function destroys any existing prefs file and it is meant to be | 152 // This function destroys any existing prefs file and it is meant to be |
150 // invoked only on first run. | 153 // invoked only on first run. |
151 // | 154 // |
152 // See chrome/installer/util/master_preferences.h for a description of | 155 // See chrome/installer/util/master_preferences.h for a description of |
153 // 'master_preferences' file. | 156 // 'master_preferences' file. |
154 ProcessMasterPreferencesResult ProcessMasterPreferences( | 157 ProcessMasterPreferencesResult ProcessMasterPreferences( |
155 const FilePath& user_data_dir, | 158 const base::FilePath& user_data_dir, |
156 MasterPrefs* out_prefs); | 159 MasterPrefs* out_prefs); |
157 | 160 |
158 // Show the first run search engine bubble at the first appropriate opportunity. | 161 // Show the first run search engine bubble at the first appropriate opportunity. |
159 // This bubble may be delayed by other UI, like global errors and sync promos. | 162 // This bubble may be delayed by other UI, like global errors and sync promos. |
160 class FirstRunBubbleLauncher : public content::NotificationObserver { | 163 class FirstRunBubbleLauncher : public content::NotificationObserver { |
161 public: | 164 public: |
162 // Show the bubble at the first appropriate opportunity. This function | 165 // Show the bubble at the first appropriate opportunity. This function |
163 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. | 166 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. |
164 static void ShowFirstRunBubbleSoon(); | 167 static void ShowFirstRunBubbleSoon(); |
165 | 168 |
166 private: | 169 private: |
167 FirstRunBubbleLauncher(); | 170 FirstRunBubbleLauncher(); |
168 virtual ~FirstRunBubbleLauncher(); | 171 virtual ~FirstRunBubbleLauncher(); |
169 | 172 |
170 // content::NotificationObserver override: | 173 // content::NotificationObserver override: |
171 virtual void Observe(int type, | 174 virtual void Observe(int type, |
172 const content::NotificationSource& source, | 175 const content::NotificationSource& source, |
173 const content::NotificationDetails& details) OVERRIDE; | 176 const content::NotificationDetails& details) OVERRIDE; |
174 | 177 |
175 content::NotificationRegistrar registrar_; | 178 content::NotificationRegistrar registrar_; |
176 | 179 |
177 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); | 180 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); |
178 }; | 181 }; |
179 | 182 |
180 } // namespace first_run | 183 } // namespace first_run |
181 | 184 |
182 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 185 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
OLD | NEW |