Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/importer/in_process_importer_bridge.cc

Issue 2487633003: Change behaivor to decide whether a search engine should be shown in the default list (Closed)
Patch Set: Update based on Peter and Nicolas's comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(), &param_filter); 131 &param_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
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() {}
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc ('k') | chrome/browser/importer/profile_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698