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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DCHECK(search_engines); | 120 DCHECK(search_engines); |
121 | 121 |
122 std::map<std::string, std::unique_ptr<TemplateURL>> search_engine_for_url; | 122 std::map<std::string, std::unique_ptr<TemplateURL>> search_engine_for_url; |
123 FirefoxURLParameterFilter param_filter; | 123 FirefoxURLParameterFilter param_filter; |
124 // The first XML file represents the default search engine in Firefox 3, so we | 124 // The first XML file represents the default search engine in Firefox 3, so we |
125 // need to keep it on top of the list. | 125 // need to keep it on top of the list. |
126 auto default_turl = search_engine_for_url.end(); | 126 auto default_turl = search_engine_for_url.end(); |
127 for (std::vector<std::string>::const_iterator xml_iter = | 127 for (std::vector<std::string>::const_iterator xml_iter = |
128 xml_data.begin(); xml_iter != xml_data.end(); ++xml_iter) { | 128 xml_data.begin(); xml_iter != xml_data.end(); ++xml_iter) { |
129 std::unique_ptr<TemplateURL> template_url = TemplateURLParser::Parse( | 129 std::unique_ptr<TemplateURL> template_url = TemplateURLParser::Parse( |
130 UIThreadSearchTermsData(nullptr), true, xml_iter->data(), | 130 UIThreadSearchTermsData(nullptr), xml_iter->data(), xml_iter->length(), |
131 xml_iter->length(), ¶m_filter); | 131 ¶m_filter); |
132 if (template_url) { | 132 if (template_url) { |
133 auto iter = search_engine_for_url.find(template_url->url()); | 133 auto iter = search_engine_for_url.find(template_url->url()); |
134 if (iter == search_engine_for_url.end()) { | 134 if (iter == search_engine_for_url.end()) { |
135 iter = search_engine_for_url | 135 iter = search_engine_for_url |
136 .insert(std::make_pair(template_url->url(), | 136 .insert(std::make_pair(template_url->url(), |
137 std::move(template_url))) | 137 std::move(template_url))) |
138 .first; | 138 .first; |
139 } else { | 139 } else { |
140 // We have already found a search engine with the same URL. We give | 140 // We have already found a search engine with the same URL. We give |
141 // priority to the latest one found, as GetSearchEnginesXMLFiles() | 141 // priority to the latest one found, as GetSearchEnginesXMLFiles() |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 BrowserThread::PostTask( | 292 BrowserThread::PostTask( |
293 BrowserThread::UI, FROM_HERE, | 293 BrowserThread::UI, FROM_HERE, |
294 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 294 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
295 } | 295 } |
296 | 296 |
297 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 297 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
298 return l10n_util::GetStringUTF16(message_id); | 298 return l10n_util::GetStringUTF16(message_id); |
299 } | 299 } |
300 | 300 |
301 InProcessImporterBridge::~InProcessImporterBridge() {} | 301 InProcessImporterBridge::~InProcessImporterBridge() {} |
OLD | NEW |