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" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/first_run/first_run.h" | 12 #include "chrome/browser/first_run/first_run.h" |
13 #include "chrome/browser/importer/firefox2_importer.h" | 13 #include "chrome/browser/importer/firefox2_importer.h" |
14 #include "chrome/browser/importer/firefox3_importer.h" | 14 #include "chrome/browser/importer/firefox3_importer.h" |
15 #include "chrome/browser/importer/firefox_importer_utils.h" | 15 #include "chrome/browser/importer/firefox_importer_utils.h" |
16 #include "chrome/browser/importer/importer_bridge.h" | 16 #include "chrome/browser/importer/importer_bridge.h" |
17 #include "chrome/browser/importer/toolbar_importer.h" | 17 #include "chrome/browser/importer/toolbar_importer.h" |
18 #include "chrome/browser/shell_integration.h" | 18 #include "chrome/browser/shell_integration.h" |
19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 | 20 |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include "chrome/browser/importer/ie_importer.h" | 22 #include "chrome/browser/importer/ie_importer.h" |
23 #include "chrome/browser/password_manager/ie7_password.h" | 23 #include "chrome/browser/password_manager/ie7_password.h" |
24 #endif | 24 #endif |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
26 #include "base/mac_util.h" | 26 #include "base/mac/mac_util.h" |
27 #include "chrome/browser/importer/safari_importer.h" | 27 #include "chrome/browser/importer/safari_importer.h" |
28 #endif | 28 #endif |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) { | 33 void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) { |
34 // IE always exists and doesn't have multiple profiles. | 34 // IE always exists and doesn't have multiple profiles. |
35 ProfileInfo* ie = new ProfileInfo(); | 35 ProfileInfo* ie = new ProfileInfo(); |
36 ie->description = l10n_util::GetString(IDS_IMPORT_FROM_IE); | 36 ie->description = l10n_util::GetString(IDS_IMPORT_FROM_IE); |
37 ie->browser_type = importer::MS_IE; | 37 ie->browser_type = importer::MS_IE; |
38 ie->source_path.clear(); | 38 ie->source_path.clear(); |
39 ie->app_path.clear(); | 39 ie->app_path.clear(); |
40 ie->services_supported = importer::HISTORY | importer::FAVORITES | | 40 ie->services_supported = importer::HISTORY | importer::FAVORITES | |
41 importer::COOKIES | importer::PASSWORDS | importer::SEARCH_ENGINES; | 41 importer::COOKIES | importer::PASSWORDS | importer::SEARCH_ENGINES; |
42 profiles->push_back(ie); | 42 profiles->push_back(ie); |
43 } | 43 } |
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(base::mac::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 = |
55 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI)); | 55 UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI)); |
56 safari->source_path.clear(); | 56 safari->source_path.clear(); |
57 safari->app_path.clear(); | 57 safari->app_path.clear(); |
58 safari->services_supported = items; | 58 safari->services_supported = items; |
59 profiles->push_back(safari); | 59 profiles->push_back(safari); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 #endif | 126 #endif |
127 case importer::BOOKMARKS_HTML: | 127 case importer::BOOKMARKS_HTML: |
128 case importer::FIREFOX2: | 128 case importer::FIREFOX2: |
129 return new Firefox2Importer(); | 129 return new Firefox2Importer(); |
130 case importer::FIREFOX3: | 130 case importer::FIREFOX3: |
131 return new Firefox3Importer(); | 131 return new Firefox3Importer(); |
132 case importer::GOOGLE_TOOLBAR5: | 132 case importer::GOOGLE_TOOLBAR5: |
133 return new Toolbar5Importer(); | 133 return new Toolbar5Importer(); |
134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
135 case importer::SAFARI: | 135 case importer::SAFARI: |
136 return new SafariImporter(mac_util::GetUserLibraryPath()); | 136 return new SafariImporter(base::mac::GetUserLibraryPath()); |
137 #endif // OS_MACOSX | 137 #endif // OS_MACOSX |
138 case importer::NO_PROFILE_TYPE: | 138 case importer::NO_PROFILE_TYPE: |
139 NOTREACHED(); | 139 NOTREACHED(); |
140 return NULL; | 140 return NULL; |
141 } | 141 } |
142 NOTREACHED(); | 142 NOTREACHED(); |
143 return NULL; | 143 return NULL; |
144 } | 144 } |
145 | 145 |
146 ImporterList::ImporterList() | 146 ImporterList::ImporterList() |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 BrowserThread::ID current_thread_id; | 255 BrowserThread::ID current_thread_id; |
256 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); | 256 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); |
257 DCHECK_EQ(current_thread_id, source_thread_id_); | 257 DCHECK_EQ(current_thread_id, source_thread_id_); |
258 | 258 |
259 source_profiles_->assign(profiles.begin(), profiles.end()); | 259 source_profiles_->assign(profiles.begin(), profiles.end()); |
260 source_profiles_loaded_ = true; | 260 source_profiles_loaded_ = true; |
261 observer_->SourceProfilesLoaded(); | 261 observer_->SourceProfilesLoaded(); |
262 observer_ = NULL; | 262 observer_ = NULL; |
263 source_thread_id_ = BrowserThread::UI; | 263 source_thread_id_ = BrowserThread::UI; |
264 } | 264 } |
OLD | NEW |