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/importer/in_process_importer_bridge.h" | 5 #include "chrome/browser/importer/in_process_importer_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/importer/external_process_importer_host.h" | 10 #include "chrome/browser/importer/external_process_importer_host.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 TemplateURLData data; | 100 TemplateURLData data; |
101 if (keyword.empty()) | 101 if (keyword.empty()) |
102 data.SetKeyword(TemplateURLService::GenerateKeyword(url)); | 102 data.SetKeyword(TemplateURLService::GenerateKeyword(url)); |
103 else | 103 else |
104 data.SetKeyword(keyword); | 104 data.SetKeyword(keyword); |
105 // We set short name by using the title if it exists. | 105 // We set short name by using the title if it exists. |
106 // Otherwise, we use the shortcut. | 106 // Otherwise, we use the shortcut. |
107 data.short_name = title.empty() ? keyword : title; | 107 data.short_name = title.empty() ? keyword : title; |
108 data.SetURL( | 108 data.SetURL( |
109 TemplateURLRef::DisplayURLToURLRef(base::UTF8ToUTF16(url.spec()))); | 109 TemplateURLRef::DisplayURLToURLRef(base::UTF8ToUTF16(url.spec()))); |
110 return new TemplateURL(NULL, data); | 110 return new TemplateURL(data); |
111 } | 111 } |
112 | 112 |
113 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | 113 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| |
114 // with the resulting TemplateURLs. | 114 // with the resulting TemplateURLs. |
115 void ParseSearchEnginesFromFirefoxXMLData( | 115 void ParseSearchEnginesFromFirefoxXMLData( |
116 const std::vector<std::string>& xml_data, | 116 const std::vector<std::string>& xml_data, |
117 std::vector<TemplateURL*>* search_engines) { | 117 std::vector<TemplateURL*>* search_engines) { |
118 DCHECK(search_engines); | 118 DCHECK(search_engines); |
119 | 119 |
120 typedef std::map<std::string, TemplateURL*> SearchEnginesMap; | 120 typedef std::map<std::string, TemplateURL*> SearchEnginesMap; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 BrowserThread::PostTask( | 276 BrowserThread::PostTask( |
277 BrowserThread::UI, FROM_HERE, | 277 BrowserThread::UI, FROM_HERE, |
278 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 278 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
279 } | 279 } |
280 | 280 |
281 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 281 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
282 return l10n_util::GetStringUTF16(message_id); | 282 return l10n_util::GetStringUTF16(message_id); |
283 } | 283 } |
284 | 284 |
285 InProcessImporterBridge::~InProcessImporterBridge() {} | 285 InProcessImporterBridge::~InProcessImporterBridge() {} |
OLD | NEW |