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 "base/memory/weak_ptr.h" | |
16 #include "chrome/browser/ui/browser_list_observer.h" | |
17 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
19 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
20 | 18 |
21 class Browser; | |
22 class CommandLine; | 19 class CommandLine; |
23 class GURL; | 20 class GURL; |
24 class PrefRegistrySyncable; | 21 class PrefRegistrySyncable; |
25 class Profile; | 22 class Profile; |
26 class ProcessSingleton; | 23 class ProcessSingleton; |
27 | 24 |
28 namespace base { | 25 namespace base { |
29 class FilePath; | 26 class FilePath; |
30 } | 27 } |
31 | 28 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // invoked only on first run. | 177 // invoked only on first run. |
181 // | 178 // |
182 // See chrome/installer/util/master_preferences.h for a description of | 179 // See chrome/installer/util/master_preferences.h for a description of |
183 // 'master_preferences' file. | 180 // 'master_preferences' file. |
184 ProcessMasterPreferencesResult ProcessMasterPreferences( | 181 ProcessMasterPreferencesResult ProcessMasterPreferences( |
185 const base::FilePath& user_data_dir, | 182 const base::FilePath& user_data_dir, |
186 MasterPrefs* out_prefs); | 183 MasterPrefs* out_prefs); |
187 | 184 |
188 // Show the first run search engine bubble at the first appropriate opportunity. | 185 // Show the first run search engine bubble at the first appropriate opportunity. |
189 // This bubble may be delayed by other UI, like global errors and sync promos. | 186 // This bubble may be delayed by other UI, like global errors and sync promos. |
190 class FirstRunBubbleLauncher | 187 class FirstRunBubbleLauncher : public content::NotificationObserver { |
191 : public content::NotificationObserver, | |
192 public chrome::BrowserListObserver, | |
193 public base::SupportsWeakPtr<FirstRunBubbleLauncher> { | |
194 public: | 188 public: |
195 // Show the bubble at the first appropriate opportunity. This function | 189 // Show the bubble at the first appropriate opportunity. This function |
196 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. | 190 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. |
197 static void ShowFirstRunBubbleSoon(); | 191 static void ShowFirstRunBubbleSoon(); |
198 | 192 |
199 private: | 193 private: |
200 FirstRunBubbleLauncher(); | 194 FirstRunBubbleLauncher(); |
201 virtual ~FirstRunBubbleLauncher(); | 195 virtual ~FirstRunBubbleLauncher(); |
202 | 196 |
203 // content::NotificationObserver override: | 197 // content::NotificationObserver override: |
204 virtual void Observe(int type, | 198 virtual void Observe(int type, |
205 const content::NotificationSource& source, | 199 const content::NotificationSource& source, |
206 const content::NotificationDetails& details) OVERRIDE; | 200 const content::NotificationDetails& details) OVERRIDE; |
207 | 201 |
208 // chrome::BrowserListObserver override: | |
209 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | |
210 | |
211 void DoShowFirstRunBubble(); | |
212 | |
213 content::NotificationRegistrar registrar_; | 202 content::NotificationRegistrar registrar_; |
214 Browser* browser_; | |
215 | 203 |
216 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); | 204 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); |
217 }; | 205 }; |
218 | 206 |
219 } // namespace first_run | 207 } // namespace first_run |
220 | 208 |
221 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 209 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
OLD | NEW |