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

Side by Side Diff: chrome/browser/search_engines/template_url_parser.cc

Issue 10381016: Remove the "autogenerate keyword" bit on TemplateURL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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/search_engines/template_url_parser.h" 5 #include "chrome/browser/search_engines/template_url_parser.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 if (derive_image_from_url_ && data_.favicon_url.is_empty()) 302 if (derive_image_from_url_ && data_.favicon_url.is_empty())
303 data_.favicon_url = TemplateURL::GenerateFaviconURL(url); 303 data_.favicon_url = TemplateURL::GenerateFaviconURL(url);
304 304
305 // TODO(jcampan): http://b/issue?id=1196285 we do not support search engines 305 // TODO(jcampan): http://b/issue?id=1196285 we do not support search engines
306 // that use POST yet. 306 // that use POST yet.
307 if (method_ == TemplateURLParsingContext::POST) 307 if (method_ == TemplateURLParsingContext::POST)
308 return NULL; 308 return NULL;
309 if (suggestion_method_ == TemplateURLParsingContext::POST) 309 if (suggestion_method_ == TemplateURLParsingContext::POST)
310 data_.suggestions_url.clear(); 310 data_.suggestions_url.clear();
311 311
312 string16 keyword(TemplateURLService::GenerateKeyword(url, false)); 312 data_.SetKeyword(TemplateURLService::GenerateKeyword(url));
313 DCHECK(!keyword.empty());
314 data_.SetKeyword(keyword);
315 data_.show_in_default_list = show_in_default_list; 313 data_.show_in_default_list = show_in_default_list;
316 return new TemplateURL(profile, data_); 314 return new TemplateURL(profile, data_);
317 } 315 }
318 316
319 // static 317 // static
320 void TemplateURLParsingContext::InitMapping() { 318 void TemplateURLParsingContext::InitMapping() {
321 kElementNameToElementTypeMap = new std::map<std::string, ElementType>; 319 kElementNameToElementTypeMap = new std::map<std::string, ElementType>;
322 (*kElementNameToElementTypeMap)[kURLElement] = URL; 320 (*kElementNameToElementTypeMap)[kURLElement] = URL;
323 (*kElementNameToElementTypeMap)[kParamElement] = PARAM; 321 (*kElementNameToElementTypeMap)[kParamElement] = PARAM;
324 (*kElementNameToElementTypeMap)[kShortNameElement] = SHORT_NAME; 322 (*kElementNameToElementTypeMap)[kShortNameElement] = SHORT_NAME;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 xmlSAXHandler sax_handler; 483 xmlSAXHandler sax_handler;
486 memset(&sax_handler, 0, sizeof(sax_handler)); 484 memset(&sax_handler, 0, sizeof(sax_handler));
487 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl; 485 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl;
488 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl; 486 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl;
489 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl; 487 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl;
490 xmlSAXUserParseMemory(&sax_handler, &context, data, static_cast<int>(length)); 488 xmlSAXUserParseMemory(&sax_handler, &context, data, static_cast<int>(length));
491 xmlSubstituteEntitiesDefault(last_sub_entities_value); 489 xmlSubstituteEntitiesDefault(last_sub_entities_value);
492 490
493 return context.GetTemplateURL(profile, show_in_default_list); 491 return context.GetTemplateURL(profile, show_in_default_list);
494 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698