| 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 #include "chrome/browser/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/updater/extension_updater.h" | 22 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 23 #include "chrome/browser/first_run/first_run_dialog.h" | |
| 24 #include "chrome/browser/first_run/first_run_internal.h" | 23 #include "chrome/browser/first_run/first_run_internal.h" |
| 25 #include "chrome/browser/google/google_util.h" | 24 #include "chrome/browser/google/google_util.h" |
| 26 #include "chrome/browser/importer/external_process_importer_host.h" | 25 #include "chrome/browser/importer/external_process_importer_host.h" |
| 27 #include "chrome/browser/importer/importer_host.h" | 26 #include "chrome/browser/importer/importer_host.h" |
| 28 #include "chrome/browser/importer/importer_list.h" | 27 #include "chrome/browser/importer/importer_list.h" |
| 29 #include "chrome/browser/importer/importer_progress_observer.h" | 28 #include "chrome/browser/importer/importer_progress_observer.h" |
| 30 #include "chrome/browser/importer/importer_type.h" | 29 #include "chrome/browser/importer/importer_type.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 32 #include "chrome/browser/search_engines/template_url_service.h" | 31 #include "chrome/browser/search_engines/template_url_service.h" |
| 33 #include "chrome/browser/search_engines/template_url_service_factory.h" | 32 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 34 #include "chrome/browser/shell_integration.h" | 33 #include "chrome/browser/shell_integration.h" |
| 35 #include "chrome/browser/signin/signin_manager.h" | 34 #include "chrome/browser/signin/signin_manager.h" |
| 36 #include "chrome/browser/signin/signin_manager_factory.h" | 35 #include "chrome/browser/signin/signin_manager_factory.h" |
| 37 #include "chrome/browser/signin/signin_tracker.h" | 36 #include "chrome/browser/signin/signin_tracker.h" |
| 38 #include "chrome/browser/ui/browser.h" | 37 #include "chrome/browser/ui/browser.h" |
| 39 #include "chrome/browser/ui/browser_finder.h" | 38 #include "chrome/browser/ui/browser_finder.h" |
| 40 #include "chrome/browser/ui/global_error/global_error_service.h" | 39 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 40 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 42 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 41 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 43 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 42 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 44 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 43 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 45 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
| 46 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
| 47 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
| 49 #include "chrome/common/startup_metric_utils.h" | |
| 50 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
| 51 #include "chrome/installer/util/master_preferences.h" | 49 #include "chrome/installer/util/master_preferences.h" |
| 52 #include "chrome/installer/util/master_preferences_constants.h" | 50 #include "chrome/installer/util/master_preferences_constants.h" |
| 53 #include "chrome/installer/util/util_constants.h" | 51 #include "chrome/installer/util/util_constants.h" |
| 54 #include "components/user_prefs/pref_registry_syncable.h" | 52 #include "components/user_prefs/pref_registry_syncable.h" |
| 55 #include "content/public/browser/notification_service.h" | 53 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/notification_types.h" | 54 #include "content/public/browser/notification_types.h" |
| 57 #include "content/public/browser/user_metrics.h" | 55 #include "content/public/browser/user_metrics.h" |
| 58 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
| 59 #include "google_apis/gaia/gaia_auth_util.h" | 57 #include "google_apis/gaia/gaia_auth_util.h" |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 did_perform_profile_import = true; | 732 did_perform_profile_import = true; |
| 735 } | 733 } |
| 736 | 734 |
| 737 void DoPostImportTasks(Profile* profile, bool make_chrome_default) { | 735 void DoPostImportTasks(Profile* profile, bool make_chrome_default) { |
| 738 if (make_chrome_default && | 736 if (make_chrome_default && |
| 739 ShellIntegration::CanSetAsDefaultBrowser() == | 737 ShellIntegration::CanSetAsDefaultBrowser() == |
| 740 ShellIntegration::SET_DEFAULT_UNATTENDED) { | 738 ShellIntegration::SET_DEFAULT_UNATTENDED) { |
| 741 ShellIntegration::SetAsDefaultBrowser(); | 739 ShellIntegration::SetAsDefaultBrowser(); |
| 742 } | 740 } |
| 743 | 741 |
| 744 base::FilePath local_state_path; | |
| 745 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | |
| 746 bool local_state_file_exists = file_util::PathExists(local_state_path); | |
| 747 | |
| 748 // Launch the first run dialog only for certain builds, and only if the user | |
| 749 // has not already set preferences. | |
| 750 if (internal::IsOrganicFirstRun() && !local_state_file_exists) { | |
| 751 startup_metric_utils::SetNonBrowserUIDisplayed(); | |
| 752 ShowFirstRunDialog(profile); | |
| 753 } | |
| 754 // Display the first run bubble if there is a default search provider. | 742 // Display the first run bubble if there is a default search provider. |
| 755 TemplateURLService* template_url = | 743 TemplateURLService* template_url = |
| 756 TemplateURLServiceFactory::GetForProfile(profile); | 744 TemplateURLServiceFactory::GetForProfile(profile); |
| 757 if (template_url && template_url->GetDefaultSearchProvider()) | 745 if (template_url && template_url->GetDefaultSearchProvider()) |
| 758 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); | 746 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); |
| 759 SetShouldShowWelcomePage(); | 747 SetShouldShowWelcomePage(); |
| 760 SetShouldDoPersonalDataManagerFirstRun(); | 748 SetShouldDoPersonalDataManagerFirstRun(); |
| 761 | 749 |
| 762 internal::DoPostImportPlatformSpecificTasks(); | 750 internal::DoPostImportPlatformSpecificTasks(profile); |
| 763 } | 751 } |
| 764 | 752 |
| 765 bool DidPerformProfileImport(bool* exited_successfully) { | 753 bool DidPerformProfileImport(bool* exited_successfully) { |
| 766 if (exited_successfully) | 754 if (exited_successfully) |
| 767 *exited_successfully = profile_import_exited_successfully; | 755 *exited_successfully = profile_import_exited_successfully; |
| 768 return did_perform_profile_import; | 756 return did_perform_profile_import; |
| 769 } | 757 } |
| 770 | 758 |
| 771 } // namespace first_run | 759 } // namespace first_run |
| OLD | NEW |