| 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 = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI); | 54 safari->description = |
| 55 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI)); |
| 55 safari->source_path.clear(); | 56 safari->source_path.clear(); |
| 56 safari->app_path.clear(); | 57 safari->app_path.clear(); |
| 57 safari->services_supported = items; | 58 safari->services_supported = items; |
| 58 profiles->push_back(safari); | 59 profiles->push_back(safari); |
| 59 } | 60 } |
| 60 #endif // defined(OS_MACOSX) | 61 #endif // defined(OS_MACOSX) |
| 61 | 62 |
| 62 void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) { | 63 void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) { |
| 63 FilePath profile_path = GetFirefoxProfilePath(); | 64 FilePath profile_path = GetFirefoxProfilePath(); |
| 64 if (profile_path.empty()) | 65 if (profile_path.empty()) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 77 if (version == 2) { | 78 if (version == 2) { |
| 78 firefox_type = importer::FIREFOX2; | 79 firefox_type = importer::FIREFOX2; |
| 79 } else if (version >= 3) { | 80 } else if (version >= 3) { |
| 80 firefox_type = importer::FIREFOX3; | 81 firefox_type = importer::FIREFOX3; |
| 81 } else { | 82 } else { |
| 82 // Ignores other versions of firefox. | 83 // Ignores other versions of firefox. |
| 83 return; | 84 return; |
| 84 } | 85 } |
| 85 | 86 |
| 86 importer::ProfileInfo* firefox = new importer::ProfileInfo(); | 87 importer::ProfileInfo* firefox = new importer::ProfileInfo(); |
| 87 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX); | 88 firefox->description = |
| 89 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX)); |
| 88 firefox->browser_type = firefox_type; | 90 firefox->browser_type = firefox_type; |
| 89 firefox->source_path = profile_path; | 91 firefox->source_path = profile_path; |
| 90 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
| 91 firefox->app_path = FilePath::FromWStringHack( | 93 firefox->app_path = FilePath::FromWStringHack( |
| 92 GetFirefoxInstallPathFromRegistry()); | 94 GetFirefoxInstallPathFromRegistry()); |
| 93 #endif | 95 #endif |
| 94 if (firefox->app_path.empty()) | 96 if (firefox->app_path.empty()) |
| 95 firefox->app_path = app_path; | 97 firefox->app_path = app_path; |
| 96 firefox->services_supported = importer::HISTORY | importer::FAVORITES | | 98 firefox->services_supported = importer::HISTORY | importer::FAVORITES | |
| 97 importer::PASSWORDS | importer::SEARCH_ENGINES; | 99 importer::PASSWORDS | importer::SEARCH_ENGINES; |
| 98 profiles->push_back(firefox); | 100 profiles->push_back(firefox); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void DetectGoogleToolbarProfiles( | 103 void DetectGoogleToolbarProfiles( |
| 102 std::vector<importer::ProfileInfo*>* profiles) { | 104 std::vector<importer::ProfileInfo*>* profiles) { |
| 103 if (FirstRun::IsChromeFirstRun()) | 105 if (FirstRun::IsChromeFirstRun()) |
| 104 return; | 106 return; |
| 105 | 107 |
| 106 importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); | 108 importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); |
| 107 google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; | 109 google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; |
| 108 google_toolbar->description = l10n_util::GetString( | 110 google_toolbar->description = UTF16ToWideHack(l10n_util::GetStringUTF16( |
| 109 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); | 111 IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); |
| 110 google_toolbar->source_path.clear(); | 112 google_toolbar->source_path.clear(); |
| 111 google_toolbar->app_path.clear(); | 113 google_toolbar->app_path.clear(); |
| 112 google_toolbar->services_supported = importer::FAVORITES; | 114 google_toolbar->services_supported = importer::FAVORITES; |
| 113 profiles->push_back(google_toolbar); | 115 profiles->push_back(google_toolbar); |
| 114 } | 116 } |
| 115 | 117 |
| 116 } // namespace | 118 } // namespace |
| 117 | 119 |
| 118 // static | 120 // static |
| 119 Importer* ImporterList::CreateImporterByType(importer::ProfileType type) { | 121 Importer* ImporterList::CreateImporterByType(importer::ProfileType type) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 BrowserThread::ID current_thread_id; | 255 BrowserThread::ID current_thread_id; |
| 254 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); | 256 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); |
| 255 DCHECK_EQ(current_thread_id, source_thread_id_); | 257 DCHECK_EQ(current_thread_id, source_thread_id_); |
| 256 | 258 |
| 257 source_profiles_->assign(profiles.begin(), profiles.end()); | 259 source_profiles_->assign(profiles.begin(), profiles.end()); |
| 258 source_profiles_loaded_ = true; | 260 source_profiles_loaded_ = true; |
| 259 observer_->SourceProfilesLoaded(); | 261 observer_->SourceProfilesLoaded(); |
| 260 observer_ = NULL; | 262 observer_ = NULL; |
| 261 source_thread_id_ = BrowserThread::UI; | 263 source_thread_id_ = BrowserThread::UI; |
| 262 } | 264 } |
| OLD | NEW |