| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class CommandLine; | 19 class CommandLine; |
| 20 class FilePath; | 20 class FilePath; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class WebContents; | 24 class WebContents; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace user_prefs { |
| 28 class PrefRegistrySyncable; |
| 29 } |
| 30 |
| 27 // This namespace contains the chrome first-run installation actions needed to | 31 // This namespace contains the chrome first-run installation actions needed to |
| 28 // 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 |
| 29 // 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 |
| 30 // 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 |
| 31 // desktop shortcut. | 35 // desktop shortcut. |
| 32 // | 36 // |
| 33 // 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. |
| 34 // 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 |
| 35 // 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. |
| 36 namespace first_run { | 40 namespace first_run { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 | 68 |
| 65 // See ProcessMasterPreferences for more info about this structure. | 69 // See ProcessMasterPreferences for more info about this structure. |
| 66 struct MasterPrefs { | 70 struct MasterPrefs { |
| 67 MasterPrefs(); | 71 MasterPrefs(); |
| 68 ~MasterPrefs(); | 72 ~MasterPrefs(); |
| 69 | 73 |
| 70 // TODO(macourteau): as part of the master preferences refactoring effort, | 74 // TODO(macourteau): as part of the master preferences refactoring effort, |
| 71 // remove items from here which are being stored temporarily only to be later | 75 // remove items from here which are being stored temporarily only to be later |
| 72 // dumped into local_state. Also see related TODO in chrome_browser_main.cc. | 76 // dumped into local_state. Also see related TODO in chrome_browser_main.cc. |
| 73 | 77 |
| 74 bool homepage_defined; | 78 bool make_chrome_default_for_user = false; |
| 75 int do_import_items; | 79 bool suppress_first_run_default_browser_prompt = false; |
| 76 int dont_import_items; | 80 bool welcome_page_on_os_upgrade_enabled = true; |
| 77 bool make_chrome_default_for_user; | |
| 78 bool suppress_first_run_default_browser_prompt; | |
| 79 bool welcome_page_on_os_upgrade_enabled; | |
| 80 std::vector<GURL> new_tabs; | 81 std::vector<GURL> new_tabs; |
| 81 std::vector<GURL> bookmarks; | 82 std::vector<GURL> bookmarks; |
| 82 std::string import_bookmarks_path; | 83 std::string import_bookmarks_path; |
| 83 std::string compressed_variations_seed; | 84 std::string compressed_variations_seed; |
| 84 std::string variations_seed; | 85 std::string variations_seed; |
| 85 std::string variations_seed_signature; | 86 std::string variations_seed_signature; |
| 86 std::string suppress_default_browser_prompt_for_version; | 87 std::string suppress_default_browser_prompt_for_version; |
| 87 }; | 88 }; |
| 88 | 89 |
| 90 void RegisterProfilePrefs( |
| 91 user_prefs::PrefRegistrySyncable* registry); |
| 92 |
| 89 // Returns true if Chrome should behave as if this is the first time Chrome is | 93 // Returns true if Chrome should behave as if this is the first time Chrome is |
| 90 // run for this user. | 94 // run for this user. |
| 91 bool IsChromeFirstRun(); | 95 bool IsChromeFirstRun(); |
| 92 | 96 |
| 93 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
| 94 // Returns true if |command_line|'s switches explicitly specify that first run | 98 // Returns true if |command_line|'s switches explicitly specify that first run |
| 95 // should be suppressed in the current run. | 99 // should be suppressed in the current run. |
| 96 bool IsFirstRunSuppressed(const base::CommandLine& command_line); | 100 bool IsFirstRunSuppressed(const base::CommandLine& command_line); |
| 97 #endif | 101 #endif |
| 98 | 102 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Returns true if the autofill personal data manager first-run action | 148 // Returns true if the autofill personal data manager first-run action |
| 145 // should be taken. | 149 // should be taken. |
| 146 // | 150 // |
| 147 // This will return true only once, the first time it is called after | 151 // This will return true only once, the first time it is called after |
| 148 // SetShouldDoPersonalDataManagerFirstRun() is called. | 152 // SetShouldDoPersonalDataManagerFirstRun() is called. |
| 149 bool ShouldDoPersonalDataManagerFirstRun(); | 153 bool ShouldDoPersonalDataManagerFirstRun(); |
| 150 | 154 |
| 151 // Log a metric for the "FirstRun.SearchEngineBubble" histogram. | 155 // Log a metric for the "FirstRun.SearchEngineBubble" histogram. |
| 152 void LogFirstRunMetric(FirstRunBubbleMetric metric); | 156 void LogFirstRunMetric(FirstRunBubbleMetric metric); |
| 153 | 157 |
| 154 // Automatically import history and home page (and search engine, if | 158 // Automatically imports items requested by |profile|'s configuration (sum of |
| 155 // ShouldShowSearchEngineDialog is true). Also imports bookmarks from file if | 159 // policies and master prefs). Also imports bookmarks from file if |
| 156 // |import_bookmarks_path| is not empty. | 160 // |import_bookmarks_path| is not empty. |
| 157 void AutoImport(Profile* profile, | 161 void AutoImport(Profile* profile, |
| 158 bool homepage_defined, | |
| 159 int import_items, | |
| 160 int dont_import_items, | |
| 161 const std::string& import_bookmarks_path); | 162 const std::string& import_bookmarks_path); |
| 162 | 163 |
| 163 // Does remaining first run tasks. This can pop the first run consent dialog on | 164 // Does remaining first run tasks. This can pop the first run consent dialog on |
| 164 // linux. |make_chrome_default_for_user| is the value of | 165 // linux. |make_chrome_default_for_user| is the value of |
| 165 // kMakeChromeDefaultForUser in master_preferences which contributes to the | 166 // kMakeChromeDefaultForUser in master_preferences which contributes to the |
| 166 // decision of making chrome default browser in post import tasks. | 167 // decision of making chrome default browser in post import tasks. |
| 167 void DoPostImportTasks(Profile* profile, bool make_chrome_default_for_user); | 168 void DoPostImportTasks(Profile* profile, bool make_chrome_default_for_user); |
| 168 | 169 |
| 169 // Returns the current state of AutoImport as recorded in a bitfield formed from | 170 // Returns the current state of AutoImport as recorded in a bitfield formed from |
| 170 // values in AutoImportState. | 171 // values in AutoImportState. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 186 // | 187 // |
| 187 // See chrome/installer/util/master_preferences.h for a description of | 188 // See chrome/installer/util/master_preferences.h for a description of |
| 188 // 'master_preferences' file. | 189 // 'master_preferences' file. |
| 189 ProcessMasterPreferencesResult ProcessMasterPreferences( | 190 ProcessMasterPreferencesResult ProcessMasterPreferences( |
| 190 const base::FilePath& user_data_dir, | 191 const base::FilePath& user_data_dir, |
| 191 MasterPrefs* out_prefs); | 192 MasterPrefs* out_prefs); |
| 192 | 193 |
| 193 } // namespace first_run | 194 } // namespace first_run |
| 194 | 195 |
| 195 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ | 196 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ |
| OLD | NEW |