| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_H_ | 5 #ifndef CHROME_BROWSER_FIRST_RUN_H_ |
| 6 #define CHROME_BROWSER_FIRST_RUN_H_ | 6 #define CHROME_BROWSER_FIRST_RUN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // fully test the custom installer. It also contains the opposite actions to | 21 // fully test the custom installer. It also contains the opposite actions to |
| 22 // execute during uninstall. When the first run UI is ready we won't | 22 // execute during uninstall. When the first run UI is ready we won't |
| 23 // do the actions unconditionally. Currently the only action is to create a | 23 // do the actions unconditionally. Currently the only action is to create a |
| 24 // desktop shortcut. | 24 // desktop shortcut. |
| 25 // | 25 // |
| 26 // The way we detect first-run is by looking at a 'sentinel' file. | 26 // The way we detect first-run is by looking at a 'sentinel' file. |
| 27 // If it does not exists we understand that we need to do the first time | 27 // If it does not exists we understand that we need to do the first time |
| 28 // install work for this user. After that the sentinel file is created. | 28 // install work for this user. After that the sentinel file is created. |
| 29 class FirstRun { | 29 class FirstRun { |
| 30 public: | 30 public: |
| 31 // Returns true if this is the first time chrome is run for this user. | 31 #if defined(OS_WIN) |
| 32 static bool IsChromeFirstRun(); | |
| 33 // Creates the desktop shortcut to chrome for the current user. Returns | 32 // Creates the desktop shortcut to chrome for the current user. Returns |
| 34 // false if it fails. It will overwrite the shortcut if it exists. | 33 // false if it fails. It will overwrite the shortcut if it exists. |
| 35 static bool CreateChromeDesktopShortcut(); | 34 static bool CreateChromeDesktopShortcut(); |
| 36 // Creates the quick launch shortcut to chrome for the current user. Returns | 35 // Creates the quick launch shortcut to chrome for the current user. Returns |
| 37 // false if it fails. It will overwrite the shortcut if it exists. | 36 // false if it fails. It will overwrite the shortcut if it exists. |
| 38 static bool CreateChromeQuickLaunchShortcut(); | 37 static bool CreateChromeQuickLaunchShortcut(); |
| 39 // Creates the sentinel file that signals that chrome has been configured. | |
| 40 static bool CreateSentinel(); | |
| 41 // Removes the sentinel file created in ConfigDone(). Returns false if the | |
| 42 // sentinel file could not be removed. | |
| 43 static bool RemoveSentinel(); | |
| 44 // Imports settings in a separate process. It spawns a second dedicated | |
| 45 // browser process that just does the import with the import progress UI. | |
| 46 static bool ImportSettings(Profile* profile, int browser_type, | |
| 47 int items_to_import, | |
| 48 gfx::NativeView parent_window); | |
| 49 // Import browser items in this process. The browser and the items to | 38 // Import browser items in this process. The browser and the items to |
| 50 // import are encoded int the command line. This function is paired with | 39 // import are encoded int the command line. This function is paired with |
| 51 // FirstRun::ImportSettings(). This function might or might not show | 40 // FirstRun::ImportSettings(). This function might or might not show |
| 52 // a visible UI depending on the cmdline parameters. | 41 // a visible UI depending on the cmdline parameters. |
| 53 static int ImportNow(Profile* profile, const CommandLine& cmdline); | 42 static int ImportNow(Profile* profile, const CommandLine& cmdline); |
| 54 | |
| 55 // The master preferences is a JSON file with the same entries as the | 43 // The master preferences is a JSON file with the same entries as the |
| 56 // 'Default\Preferences' file. This function locates this file from | 44 // 'Default\Preferences' file. This function locates this file from |
| 57 // master_pref_path or if that path is empty from the default location | 45 // master_pref_path or if that path is empty from the default location |
| 58 // which is '<path to chrome.exe>\master_preferences', and process it | 46 // which is '<path to chrome.exe>\master_preferences', and process it |
| 59 // so it becomes the default preferences in profile pointed by user_data_dir. | 47 // so it becomes the default preferences in profile pointed by user_data_dir. |
| 60 // After processing the file, the function returns true if showing the | 48 // After processing the file, the function returns true if showing the |
| 61 // first run dialog is needed, and returns false if skipping first run | 49 // first run dialog is needed, and returns false if skipping first run |
| 62 // dialogs. The detailed settings in the preference file is reported via | 50 // dialogs. The detailed settings in the preference file is reported via |
| 63 // preference_details. | 51 // preference_details. |
| 64 // | 52 // |
| 65 // This function destroys any existing prefs file and it is meant to be | 53 // This function destroys any existing prefs file and it is meant to be |
| 66 // invoked only on first run. | 54 // invoked only on first run. |
| 67 // | 55 // |
| 68 // See chrome/installer/util/master_preferences.h for a description of | 56 // See chrome/installer/util/master_preferences.h for a description of |
| 69 // 'master_preferences' file. | 57 // 'master_preferences' file. |
| 70 static bool ProcessMasterPreferences(const FilePath& user_data_dir, | 58 static bool ProcessMasterPreferences(const FilePath& user_data_dir, |
| 71 const FilePath& master_prefs_path, | 59 const FilePath& master_prefs_path, |
| 72 std::vector<std::wstring>* new_tabs, | 60 std::vector<std::wstring>* new_tabs, |
| 73 int* ping_delay, | 61 int* ping_delay, |
| 74 bool* homepage_defined, | 62 bool* homepage_defined, |
| 75 int* do_import_items, | 63 int* do_import_items, |
| 76 int* dont_import_items); | 64 int* dont_import_items); |
| 65 #endif // OS_WIN |
| 66 |
| 67 // Returns true if this is the first time chrome is run for this user. |
| 68 static bool IsChromeFirstRun(); |
| 69 // Creates the sentinel file that signals that chrome has been configured. |
| 70 static bool CreateSentinel(); |
| 71 // Removes the sentinel file created in ConfigDone(). Returns false if the |
| 72 // sentinel file could not be removed. |
| 73 static bool RemoveSentinel(); |
| 74 // Imports settings in a separate process. It spawns a second dedicated |
| 75 // browser process that just does the import with the import progress UI. |
| 76 static bool ImportSettings(Profile* profile, int browser_type, |
| 77 int items_to_import, |
| 78 gfx::NativeView parent_window); |
| 77 | 79 |
| 78 // Sets the kShouldShowFirstRunBubble local state pref so that the browser | 80 // Sets the kShouldShowFirstRunBubble local state pref so that the browser |
| 79 // shows the bubble once the main message loop gets going. Returns false if | 81 // shows the bubble once the main message loop gets going. Returns false if |
| 80 // the pref could not be set. | 82 // the pref could not be set. |
| 81 static bool SetShowFirstRunBubblePref(); | 83 static bool SetShowFirstRunBubblePref(); |
| 82 | 84 |
| 83 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the | 85 // Sets the kShouldUseOEMFirstRunBubble local state pref so that the |
| 84 // browser shows the OEM first run bubble once the main message loop | 86 // browser shows the OEM first run bubble once the main message loop |
| 85 // gets going. Returns false if the pref could not be set. | 87 // gets going. Returns false if the pref could not be set. |
| 86 static bool SetOEMFirstRunBubblePref(); | 88 static bool SetOEMFirstRunBubblePref(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // preferences and will override default behavior of importer. | 167 // preferences and will override default behavior of importer. |
| 166 // Returns true if the user clicked "Start", false if the user pressed "Cancel" | 168 // Returns true if the user clicked "Start", false if the user pressed "Cancel" |
| 167 // or closed the dialog. | 169 // or closed the dialog. |
| 168 bool OpenFirstRunDialog(Profile* profile, | 170 bool OpenFirstRunDialog(Profile* profile, |
| 169 bool homepage_defined, | 171 bool homepage_defined, |
| 170 int import_items, | 172 int import_items, |
| 171 int dont_import_items, | 173 int dont_import_items, |
| 172 ProcessSingleton* process_singleton); | 174 ProcessSingleton* process_singleton); |
| 173 | 175 |
| 174 #endif // CHROME_BROWSER_FIRST_RUN_H_ | 176 #endif // CHROME_BROWSER_FIRST_RUN_H_ |
| OLD | NEW |