| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/extensions/updater/extension_updater.h" | 23 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 24 #include "chrome/browser/first_run/first_run_dialog.h" | 24 #include "chrome/browser/first_run/first_run_dialog.h" |
| 25 #include "chrome/browser/first_run/first_run_import_observer.h" | 25 #include "chrome/browser/first_run/first_run_import_observer.h" |
| 26 #include "chrome/browser/first_run/first_run_internal.h" | 26 #include "chrome/browser/first_run/first_run_internal.h" |
| 27 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
| 28 #include "chrome/browser/importer/external_process_importer_host.h" | 28 #include "chrome/browser/importer/external_process_importer_host.h" |
| 29 #include "chrome/browser/importer/importer_host.h" | 29 #include "chrome/browser/importer/importer_host.h" |
| 30 #include "chrome/browser/importer/importer_list.h" | 30 #include "chrome/browser/importer/importer_list.h" |
| 31 #include "chrome/browser/importer/importer_progress_dialog.h" | 31 #include "chrome/browser/importer/importer_progress_dialog.h" |
| 32 #include "chrome/browser/importer/importer_progress_observer.h" | 32 #include "chrome/browser/importer/importer_progress_observer.h" |
| 33 #include "chrome/browser/process_singleton.h" | |
| 34 #include "chrome/browser/profiles/profile_manager.h" | 33 #include "chrome/browser/profiles/profile_manager.h" |
| 35 #include "chrome/browser/search_engines/template_url_service.h" | 34 #include "chrome/browser/search_engines/template_url_service.h" |
| 36 #include "chrome/browser/search_engines/template_url_service_factory.h" | 35 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 37 #include "chrome/browser/shell_integration.h" | 36 #include "chrome/browser/shell_integration.h" |
| 38 #include "chrome/browser/signin/signin_manager.h" | 37 #include "chrome/browser/signin/signin_manager.h" |
| 39 #include "chrome/browser/signin/signin_manager_factory.h" | 38 #include "chrome/browser/signin/signin_manager_factory.h" |
| 40 #include "chrome/browser/signin/signin_tracker.h" | 39 #include "chrome/browser/signin/signin_tracker.h" |
| 41 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
| 42 #include "chrome/browser/ui/browser_finder.h" | 41 #include "chrome/browser/ui/browser_finder.h" |
| 43 #include "chrome/browser/ui/browser_list.h" | 42 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); | 669 internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); |
| 671 internal::SetDefaultBrowser(install_prefs.get()); | 670 internal::SetDefaultBrowser(install_prefs.get()); |
| 672 | 671 |
| 673 return DO_FIRST_RUN_TASKS; | 672 return DO_FIRST_RUN_TASKS; |
| 674 } | 673 } |
| 675 | 674 |
| 676 void AutoImport( | 675 void AutoImport( |
| 677 Profile* profile, | 676 Profile* profile, |
| 678 bool homepage_defined, | 677 bool homepage_defined, |
| 679 int import_items, | 678 int import_items, |
| 680 int dont_import_items, | 679 int dont_import_items) { |
| 681 ProcessSingleton* process_singleton) { | |
| 682 #if !defined(USE_AURA) | 680 #if !defined(USE_AURA) |
| 683 // We need to avoid dispatching new tabs when we are importing because | |
| 684 // that will lead to data corruption or a crash. Because there is no UI for | |
| 685 // the import process, we pass NULL as the window to bring to the foreground | |
| 686 // when a CopyData message comes in; this causes the message to be silently | |
| 687 // discarded, which is the correct behavior during the import process. | |
| 688 process_singleton->Lock(NULL); | |
| 689 | |
| 690 scoped_refptr<ImporterHost> importer_host; | 681 scoped_refptr<ImporterHost> importer_host; |
| 691 // TODO(csilv,mirandac): Out-of-process import has only been qualified on | 682 // TODO(csilv,mirandac): Out-of-process import has only been qualified on |
| 692 // MacOS X, so we will only use it on that platform since it is required. | 683 // MacOS X, so we will only use it on that platform since it is required. |
| 693 // Remove this conditional logic once oop import is qualified for | 684 // Remove this conditional logic once oop import is qualified for |
| 694 // Linux/Windows. http://crbug.com/22142 | 685 // Linux/Windows. http://crbug.com/22142 |
| 695 #if defined(OS_MACOSX) | 686 #if defined(OS_MACOSX) |
| 696 importer_host = new ExternalProcessImporterHost; | 687 importer_host = new ExternalProcessImporterHost; |
| 697 #else | 688 #else |
| 698 importer_host = new ImporterHost; | 689 importer_host = new ImporterHost; |
| 699 #endif | 690 #endif |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 importer::FAVORITES, | 746 importer::FAVORITES, |
| 756 items); | 747 items); |
| 757 | 748 |
| 758 profile_import_exited_successfully = | 749 profile_import_exited_successfully = |
| 759 internal::ImportSettings(profile, importer_host, importer_list, items); | 750 internal::ImportSettings(profile, importer_host, importer_list, items); |
| 760 DCHECK(profile_import_exited_successfully); | 751 DCHECK(profile_import_exited_successfully); |
| 761 } | 752 } |
| 762 | 753 |
| 763 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); | 754 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); |
| 764 | 755 |
| 765 process_singleton->Unlock(); | |
| 766 first_run::CreateSentinel(); | 756 first_run::CreateSentinel(); |
| 767 #endif // !defined(USE_AURA) | 757 #endif // !defined(USE_AURA) |
| 768 did_perform_profile_import = true; | 758 did_perform_profile_import = true; |
| 769 } | 759 } |
| 770 | 760 |
| 771 void DoPostImportTasks(Profile* profile, bool make_chrome_default) { | 761 void DoPostImportTasks(Profile* profile, bool make_chrome_default) { |
| 772 if (make_chrome_default && | 762 if (make_chrome_default && |
| 773 ShellIntegration::CanSetAsDefaultBrowser() == | 763 ShellIntegration::CanSetAsDefaultBrowser() == |
| 774 ShellIntegration::SET_DEFAULT_UNATTENDED) { | 764 ShellIntegration::SET_DEFAULT_UNATTENDED) { |
| 775 ShellIntegration::SetAsDefaultBrowser(); | 765 ShellIntegration::SetAsDefaultBrowser(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 798 internal::DoPostImportPlatformSpecificTasks(); | 788 internal::DoPostImportPlatformSpecificTasks(); |
| 799 } | 789 } |
| 800 | 790 |
| 801 bool DidPerformProfileImport(bool* exited_successfully) { | 791 bool DidPerformProfileImport(bool* exited_successfully) { |
| 802 if (exited_successfully) | 792 if (exited_successfully) |
| 803 *exited_successfully = profile_import_exited_successfully; | 793 *exited_successfully = profile_import_exited_successfully; |
| 804 return did_perform_profile_import; | 794 return did_perform_profile_import; |
| 805 } | 795 } |
| 806 | 796 |
| 807 } // namespace first_run | 797 } // namespace first_run |
| OLD | NEW |