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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // If it does not exist we understand that we need to do the first time | 31 // If it does not exist we understand that we need to do the first time |
32 // install work for this user. After that the sentinel file is created. | 32 // install work for this user. After that the sentinel file is created. |
33 namespace first_run { | 33 namespace first_run { |
34 | 34 |
35 enum FirstRunBubbleMetric { | 35 enum FirstRunBubbleMetric { |
36 FIRST_RUN_BUBBLE_SHOWN = 0, // The search engine bubble was shown. | 36 FIRST_RUN_BUBBLE_SHOWN = 0, // The search engine bubble was shown. |
37 FIRST_RUN_BUBBLE_CHANGE_INVOKED, // The bubble's "Change" was invoked. | 37 FIRST_RUN_BUBBLE_CHANGE_INVOKED, // The bubble's "Change" was invoked. |
38 NUM_FIRST_RUN_BUBBLE_METRICS | 38 NUM_FIRST_RUN_BUBBLE_METRICS |
39 }; | 39 }; |
40 | 40 |
| 41 enum ProcessMasterPreferencesResult { |
| 42 SHOW_FIRST_RUN = 0, // Should show the first run flow. |
| 43 SKIP_FIRST_RUN, // Should skip the first run flow. |
| 44 EULA_EXIT_NOW, // Should immediately exit due to EULA flow. |
| 45 }; |
| 46 |
41 // See ProcessMasterPreferences for more info about this structure. | 47 // See ProcessMasterPreferences for more info about this structure. |
42 struct MasterPrefs { | 48 struct MasterPrefs { |
43 MasterPrefs(); | 49 MasterPrefs(); |
44 ~MasterPrefs(); | 50 ~MasterPrefs(); |
45 | 51 |
46 int ping_delay; | 52 int ping_delay; |
47 bool homepage_defined; | 53 bool homepage_defined; |
48 int do_import_items; | 54 int do_import_items; |
49 int dont_import_items; | 55 int dont_import_items; |
50 bool make_chrome_default; | 56 bool make_chrome_default; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // cmdline parameters. | 106 // cmdline parameters. |
101 int ImportNow(Profile* profile, const CommandLine& cmdline); | 107 int ImportNow(Profile* profile, const CommandLine& cmdline); |
102 | 108 |
103 // Returns the path for the master preferences file. | 109 // Returns the path for the master preferences file. |
104 FilePath MasterPrefsPath(); | 110 FilePath MasterPrefsPath(); |
105 | 111 |
106 // The master preferences is a JSON file with the same entries as the | 112 // The master preferences is a JSON file with the same entries as the |
107 // 'Default\Preferences' file. This function locates this file from a standard | 113 // 'Default\Preferences' file. This function locates this file from a standard |
108 // location and processes it so it becomes the default preferences in the | 114 // location and processes it so it becomes the default preferences in the |
109 // profile pointed to by |user_data_dir|. After processing the file, the | 115 // profile pointed to by |user_data_dir|. After processing the file, the |
110 // function returns true if and only if showing the first run dialog is | 116 // function returns a value from the ProcessMasterPreferencesResult enum, |
111 // needed. The detailed settings in the preference file are reported via | 117 // indicating whether the first run flow should be shown, skipped, or whether |
112 // |preference_details|. | 118 // the browser should exit. |
113 // | 119 // |
114 // This function destroys any existing prefs file and it is meant to be | 120 // This function destroys any existing prefs file and it is meant to be |
115 // invoked only on first run. | 121 // invoked only on first run. |
116 // | 122 // |
117 // See chrome/installer/util/master_preferences.h for a description of | 123 // See chrome/installer/util/master_preferences.h for a description of |
118 // 'master_preferences' file. | 124 // 'master_preferences' file. |
119 bool ProcessMasterPreferences(const FilePath& user_data_dir, | 125 ProcessMasterPreferencesResult ProcessMasterPreferences( |
120 MasterPrefs* out_prefs); | 126 const FilePath& user_data_dir, |
| 127 MasterPrefs* out_prefs); |
121 | 128 |
122 // Show the first run search engine bubble at the first appropriate opportunity. | 129 // Show the first run search engine bubble at the first appropriate opportunity. |
123 // This bubble may be delayed by other UI, like global errors and sync promos. | 130 // This bubble may be delayed by other UI, like global errors and sync promos. |
124 class FirstRunBubbleLauncher : public content::NotificationObserver { | 131 class FirstRunBubbleLauncher : public content::NotificationObserver { |
125 public: | 132 public: |
126 // Show the bubble at the first appropriate opportunity. This function | 133 // Show the bubble at the first appropriate opportunity. This function |
127 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. | 134 // instantiates a FirstRunBubbleLauncher, which manages its own lifetime. |
128 static void ShowFirstRunBubbleSoon(); | 135 static void ShowFirstRunBubbleSoon(); |
129 | 136 |
130 private: | 137 private: |
131 FirstRunBubbleLauncher(); | 138 FirstRunBubbleLauncher(); |
132 virtual ~FirstRunBubbleLauncher(); | 139 virtual ~FirstRunBubbleLauncher(); |
133 | 140 |
134 // content::NotificationObserver override: | 141 // content::NotificationObserver override: |
135 virtual void Observe(int type, | 142 virtual void Observe(int type, |
136 const content::NotificationSource& source, | 143 const content::NotificationSource& source, |
137 const content::NotificationDetails& details) OVERRIDE; | 144 const content::NotificationDetails& details) OVERRIDE; |
138 | 145 |
139 content::NotificationRegistrar registrar_; | 146 content::NotificationRegistrar registrar_; |
140 | 147 |
141 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); | 148 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleLauncher); |
142 }; | 149 }; |
143 | 150 |
144 } // namespace first_run | 151 } // namespace first_run |
145 | 152 |
146 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 153 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
OLD | NEW |