| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 676 } |
| 677 | 677 |
| 678 void AutoImport( | 678 void AutoImport( |
| 679 Profile* profile, | 679 Profile* profile, |
| 680 bool homepage_defined, | 680 bool homepage_defined, |
| 681 int import_items, | 681 int import_items, |
| 682 int dont_import_items, | 682 int dont_import_items, |
| 683 const std::string& import_bookmarks_path) { | 683 const std::string& import_bookmarks_path) { |
| 684 #if !defined(USE_AURA) | 684 #if !defined(USE_AURA) |
| 685 // Deletes itself. | 685 // Deletes itself. |
| 686 ImporterHost* importer_host; | 686 ImporterHost* importer_host = new ExternalProcessImporterHost; |
| 687 // TODO(csilv,mirandac): Out-of-process import has only been qualified on | |
| 688 // MacOS X and Windows, so we will only use it on those platforms. | |
| 689 // Linux still uses the in-process import (http://crbug.com/56816). | |
| 690 #if defined(OS_MACOSX) || defined(OS_WIN) | |
| 691 importer_host = new ExternalProcessImporterHost; | |
| 692 #else | |
| 693 importer_host = new ImporterHost; | |
| 694 #endif | |
| 695 | 687 |
| 696 base::FilePath local_state_path; | 688 base::FilePath local_state_path; |
| 697 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 689 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 698 bool local_state_file_exists = file_util::PathExists(local_state_path); | 690 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 699 | 691 |
| 700 scoped_refptr<ImporterList> importer_list(new ImporterList(NULL)); | 692 scoped_refptr<ImporterList> importer_list(new ImporterList(NULL)); |
| 701 importer_list->DetectSourceProfilesHack( | 693 importer_list->DetectSourceProfilesHack( |
| 702 g_browser_process->GetApplicationLocale()); | 694 g_browser_process->GetApplicationLocale()); |
| 703 | 695 |
| 704 // Do import if there is an available profile for us to import. | 696 // Do import if there is an available profile for us to import. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 &items); | 744 &items); |
| 753 | 745 |
| 754 importer::LogImporterUseToMetrics( | 746 importer::LogImporterUseToMetrics( |
| 755 "AutoImport", importer_list->GetSourceProfileAt(0).importer_type); | 747 "AutoImport", importer_list->GetSourceProfileAt(0).importer_type); |
| 756 | 748 |
| 757 ImportSettings(profile, importer_host, importer_list, items); | 749 ImportSettings(profile, importer_host, importer_list, items); |
| 758 } | 750 } |
| 759 | 751 |
| 760 if (!import_bookmarks_path.empty()) { | 752 if (!import_bookmarks_path.empty()) { |
| 761 // Deletes itself. | 753 // Deletes itself. |
| 762 ImporterHost* file_importer_host; | 754 ImporterHost* file_importer_host = new ExternalProcessImporterHost; |
| 763 // TODO(gab): Make Linux use OOP import as well (http://crbug.com/56816) and | |
| 764 // get rid of these ugly ifdefs. | |
| 765 #if defined(OS_MACOSX) || defined(OS_WIN) | |
| 766 file_importer_host = new ExternalProcessImporterHost; | |
| 767 #else | |
| 768 file_importer_host = new ImporterHost; | |
| 769 #endif | |
| 770 file_importer_host->set_headless(); | 755 file_importer_host->set_headless(); |
| 771 | 756 |
| 772 ImportFromFile(profile, file_importer_host, import_bookmarks_path); | 757 ImportFromFile(profile, file_importer_host, import_bookmarks_path); |
| 773 } | 758 } |
| 774 | 759 |
| 775 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); | 760 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); |
| 776 | 761 |
| 777 #endif // !defined(USE_AURA) | 762 #endif // !defined(USE_AURA) |
| 778 g_auto_import_state |= AUTO_IMPORT_CALLED; | 763 g_auto_import_state |= AUTO_IMPORT_CALLED; |
| 779 } | 764 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 794 SetShouldDoPersonalDataManagerFirstRun(); | 779 SetShouldDoPersonalDataManagerFirstRun(); |
| 795 | 780 |
| 796 internal::DoPostImportPlatformSpecificTasks(profile); | 781 internal::DoPostImportPlatformSpecificTasks(profile); |
| 797 } | 782 } |
| 798 | 783 |
| 799 uint16 auto_import_state() { | 784 uint16 auto_import_state() { |
| 800 return g_auto_import_state; | 785 return g_auto_import_state; |
| 801 } | 786 } |
| 802 | 787 |
| 803 } // namespace first_run | 788 } // namespace first_run |
| OLD | NEW |