| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/importer/importer_list.h" | 5 #include "chrome/browser/importer/importer_list.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #endif // defined(OS_WIN) | 44 #endif // defined(OS_WIN) |
| 45 | 45 |
| 46 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| 47 void DetectSafariProfiles(std::vector<importer::ProfileInfo*>* profiles) { | 47 void DetectSafariProfiles(std::vector<importer::ProfileInfo*>* profiles) { |
| 48 uint16 items = importer::NONE; | 48 uint16 items = importer::NONE; |
| 49 if (!SafariImporter::CanImport(mac_util::GetUserLibraryPath(), &items)) | 49 if (!SafariImporter::CanImport(mac_util::GetUserLibraryPath(), &items)) |
| 50 return; | 50 return; |
| 51 | 51 |
| 52 importer::ProfileInfo* safari = new importer::ProfileInfo(); | 52 importer::ProfileInfo* safari = new importer::ProfileInfo(); |
| 53 safari->browser_type = importer::SAFARI; | 53 safari->browser_type = importer::SAFARI; |
| 54 safari->description = | 54 safari->description = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI); |
| 55 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI)); | |
| 56 safari->source_path.clear(); | 55 safari->source_path.clear(); |
| 57 safari->app_path.clear(); | 56 safari->app_path.clear(); |
| 58 safari->services_supported = items; | 57 safari->services_supported = items; |
| 59 profiles->push_back(safari); | 58 profiles->push_back(safari); |
| 60 } | 59 } |
| 61 #endif // defined(OS_MACOSX) | 60 #endif // defined(OS_MACOSX) |
| 62 | 61 |
| 63 void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) { | 62 void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) { |
| 64 FilePath profile_path = GetFirefoxProfilePath(); | 63 FilePath profile_path = GetFirefoxProfilePath(); |
| 65 if (profile_path.empty()) | 64 if (profile_path.empty()) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 if (version == 2) { | 77 if (version == 2) { |
| 79 firefox_type = importer::FIREFOX2; | 78 firefox_type = importer::FIREFOX2; |
| 80 } else if (version >= 3) { | 79 } else if (version >= 3) { |
| 81 firefox_type = importer::FIREFOX3; | 80 firefox_type = importer::FIREFOX3; |
| 82 } else { | 81 } else { |
| 83 // Ignores other versions of firefox. | 82 // Ignores other versions of firefox. |
| 84 return; | 83 return; |
| 85 } | 84 } |
| 86 | 85 |
| 87 importer::ProfileInfo* firefox = new importer::ProfileInfo(); | 86 importer::ProfileInfo* firefox = new importer::ProfileInfo(); |
| 88 firefox->description = | 87 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX); |
| 89 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX)); | |
| 90 firefox->browser_type = firefox_type; | 88 firefox->browser_type = firefox_type; |
| 91 firefox->source_path = profile_path; | 89 firefox->source_path = profile_path; |
| 92 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
| 93 firefox->app_path = FilePath::FromWStringHack( | 91 firefox->app_path = FilePath::FromWStringHack( |
| 94 GetFirefoxInstallPathFromRegistry()); | 92 GetFirefoxInstallPathFromRegistry()); |
| 95 #endif | 93 #endif |
| 96 if (firefox->app_path.empty()) | 94 if (firefox->app_path.empty()) |
| 97 firefox->app_path = app_path; | 95 firefox->app_path = app_path; |
| 98 firefox->services_supported = importer::HISTORY | importer::FAVORITES | | 96 firefox->services_supported = importer::HISTORY | importer::FAVORITES | |
| 99 importer::PASSWORDS | importer::SEARCH_ENGINES; | 97 importer::PASSWORDS | importer::SEARCH_ENGINES; |
| 100 profiles->push_back(firefox); | 98 profiles->push_back(firefox); |
| 101 } | 99 } |
| 102 | 100 |
| 103 void DetectGoogleToolbarProfiles( | 101 void DetectGoogleToolbarProfiles( |
| 104 std::vector<importer::ProfileInfo*>* profiles) { | 102 std::vector<importer::ProfileInfo*>* profiles) { |
| 105 if (FirstRun::IsChromeFirstRun()) | 103 if (FirstRun::IsChromeFirstRun()) |
| 106 return; | 104 return; |
| 107 | 105 |
| 108 importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); | 106 importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); |
| 109 google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; | 107 google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; |
| 110 google_toolbar->description = UTF16ToWideHack(l10n_util::GetStringUTF16( | 108 google_toolbar->description = l10n_util::GetString( |
| 111 IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); | 109 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); |
| 112 google_toolbar->source_path.clear(); | 110 google_toolbar->source_path.clear(); |
| 113 google_toolbar->app_path.clear(); | 111 google_toolbar->app_path.clear(); |
| 114 google_toolbar->services_supported = importer::FAVORITES; | 112 google_toolbar->services_supported = importer::FAVORITES; |
| 115 profiles->push_back(google_toolbar); | 113 profiles->push_back(google_toolbar); |
| 116 } | 114 } |
| 117 | 115 |
| 118 } // namespace | 116 } // namespace |
| 119 | 117 |
| 120 // static | 118 // static |
| 121 Importer* ImporterList::CreateImporterByType(importer::ProfileType type) { | 119 Importer* ImporterList::CreateImporterByType(importer::ProfileType type) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 BrowserThread::ID current_thread_id; | 253 BrowserThread::ID current_thread_id; |
| 256 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); | 254 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); |
| 257 DCHECK_EQ(current_thread_id, source_thread_id_); | 255 DCHECK_EQ(current_thread_id, source_thread_id_); |
| 258 | 256 |
| 259 source_profiles_->assign(profiles.begin(), profiles.end()); | 257 source_profiles_->assign(profiles.begin(), profiles.end()); |
| 260 source_profiles_loaded_ = true; | 258 source_profiles_loaded_ = true; |
| 261 observer_->SourceProfilesLoaded(); | 259 observer_->SourceProfilesLoaded(); |
| 262 observer_ = NULL; | 260 observer_ = NULL; |
| 263 source_thread_id_ = BrowserThread::UI; | 261 source_thread_id_ = BrowserThread::UI; |
| 264 } | 262 } |
| OLD | NEW |