| 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" |
| 11 #include "chrome/browser/search_engines/template_url_parser.h" | 11 #include "chrome/browser/search_engines/template_url_parser.h" |
| 12 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 12 #include "chrome/common/importer/imported_bookmark_entry.h" | 13 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 13 #include "chrome/common/importer/imported_favicon_usage.h" | 14 #include "chrome/common/importer/imported_favicon_usage.h" |
| 14 #include "components/autofill/core/common/password_form.h" | 15 #include "components/autofill/core/common/password_form.h" |
| 15 #include "components/search_engines/template_url.h" | 16 #include "components/search_engines/template_url.h" |
| 16 #include "components/search_engines/template_url_prepopulate_data.h" | 17 #include "components/search_engines/template_url_prepopulate_data.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 | 20 |
| 20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 21 #include "components/os_crypt/ie7_password_win.h" | 22 #include "components/os_crypt/ie7_password_win.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 DCHECK(search_engines); | 118 DCHECK(search_engines); |
| 118 | 119 |
| 119 typedef std::map<std::string, TemplateURL*> SearchEnginesMap; | 120 typedef std::map<std::string, TemplateURL*> SearchEnginesMap; |
| 120 SearchEnginesMap search_engine_for_url; | 121 SearchEnginesMap search_engine_for_url; |
| 121 FirefoxURLParameterFilter param_filter; | 122 FirefoxURLParameterFilter param_filter; |
| 122 // The first XML file represents the default search engine in Firefox 3, so we | 123 // The first XML file represents the default search engine in Firefox 3, so we |
| 123 // need to keep it on top of the list. | 124 // need to keep it on top of the list. |
| 124 SearchEnginesMap::const_iterator default_turl = search_engine_for_url.end(); | 125 SearchEnginesMap::const_iterator default_turl = search_engine_for_url.end(); |
| 125 for (std::vector<std::string>::const_iterator xml_iter = | 126 for (std::vector<std::string>::const_iterator xml_iter = |
| 126 xml_data.begin(); xml_iter != xml_data.end(); ++xml_iter) { | 127 xml_data.begin(); xml_iter != xml_data.end(); ++xml_iter) { |
| 127 TemplateURL* template_url = TemplateURLParser::Parse(NULL, true, | 128 TemplateURL* template_url = TemplateURLParser::Parse( |
| 129 UIThreadSearchTermsData(NULL), true, |
| 128 xml_iter->data(), xml_iter->length(), ¶m_filter); | 130 xml_iter->data(), xml_iter->length(), ¶m_filter); |
| 129 if (template_url) { | 131 if (template_url) { |
| 130 SearchEnginesMap::iterator iter = | 132 SearchEnginesMap::iterator iter = |
| 131 search_engine_for_url.find(template_url->url()); | 133 search_engine_for_url.find(template_url->url()); |
| 132 if (iter == search_engine_for_url.end()) { | 134 if (iter == search_engine_for_url.end()) { |
| 133 iter = search_engine_for_url.insert( | 135 iter = search_engine_for_url.insert( |
| 134 std::make_pair(template_url->url(), template_url)).first; | 136 std::make_pair(template_url->url(), template_url)).first; |
| 135 } else { | 137 } else { |
| 136 // We have already found a search engine with the same URL. We give | 138 // We have already found a search engine with the same URL. We give |
| 137 // priority to the latest one found, as GetSearchEnginesXMLFiles() | 139 // priority to the latest one found, as GetSearchEnginesXMLFiles() |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 BrowserThread::PostTask( | 277 BrowserThread::PostTask( |
| 276 BrowserThread::UI, FROM_HERE, | 278 BrowserThread::UI, FROM_HERE, |
| 277 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 279 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
| 278 } | 280 } |
| 279 | 281 |
| 280 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 282 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
| 281 return l10n_util::GetStringUTF16(message_id); | 283 return l10n_util::GetStringUTF16(message_id); |
| 282 } | 284 } |
| 283 | 285 |
| 284 InProcessImporterBridge::~InProcessImporterBridge() {} | 286 InProcessImporterBridge::~InProcessImporterBridge() {} |
| OLD | NEW |