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

Side by Side Diff: components/search_engines/template_url_parser.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/template_url_parser.h" 5 #include "components/search_engines/template_url_parser.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 // If the image was a data URL, use the favicon from the search URL instead. 313 // If the image was a data URL, use the favicon from the search URL instead.
314 // (see the TODO in EndElementImpl()). 314 // (see the TODO in EndElementImpl()).
315 GURL search_url(data_.url()); 315 GURL search_url(data_.url());
316 if (derive_image_from_url_ && data_.favicon_url.is_empty()) 316 if (derive_image_from_url_ && data_.favicon_url.is_empty())
317 data_.favicon_url = TemplateURL::GenerateFaviconURL(search_url); 317 data_.favicon_url = TemplateURL::GenerateFaviconURL(search_url);
318 318
319 // Generate a keyword for this search engine if a custom one was not present 319 // Generate a keyword for this search engine if a custom one was not present
320 // in the imported data. 320 // in the imported data.
321 if (!has_custom_keyword_) 321 if (!has_custom_keyword_)
322 data_.SetKeyword(TemplateURL::GenerateKeyword( 322 data_.SetKeyword(TemplateURL::GenerateKeyword(search_url));
323 search_url, search_terms_data.GetAcceptLanguages()));
324 323
325 data_.show_in_default_list = show_in_default_list; 324 data_.show_in_default_list = show_in_default_list;
326 325
327 // Bail if the search URL is empty or if either TemplateURLRef is invalid. 326 // Bail if the search URL is empty or if either TemplateURLRef is invalid.
328 scoped_ptr<TemplateURL> template_url(new TemplateURL(data_)); 327 scoped_ptr<TemplateURL> template_url(new TemplateURL(data_));
329 if (template_url->url().empty() || 328 if (template_url->url().empty() ||
330 !template_url->url_ref().IsValid(search_terms_data) || 329 !template_url->url_ref().IsValid(search_terms_data) ||
331 (!template_url->suggestions_url().empty() && 330 (!template_url->suggestions_url().empty() &&
332 !template_url->suggestions_url_ref().IsValid(search_terms_data))) { 331 !template_url->suggestions_url_ref().IsValid(search_terms_data))) {
333 return NULL; 332 return NULL;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl; 507 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl;
509 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl; 508 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl;
510 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl; 509 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl;
511 int error = xmlSAXUserParseMemory(&sax_handler, &context, data, 510 int error = xmlSAXUserParseMemory(&sax_handler, &context, data,
512 static_cast<int>(length)); 511 static_cast<int>(length));
513 xmlSubstituteEntitiesDefault(last_sub_entities_value); 512 xmlSubstituteEntitiesDefault(last_sub_entities_value);
514 513
515 return error ? 514 return error ?
516 NULL : context.GetTemplateURL(search_terms_data, show_in_default_list); 515 NULL : context.GetTemplateURL(search_terms_data, show_in_default_list);
517 } 516 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url.cc ('k') | components/search_engines/template_url_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698