| 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/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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 context->derive_image_from_url_ = true; | 253 context->derive_image_from_url_ = true; |
| 254 } else if (context->image_is_valid_for_favicon_ && image_url.is_valid() && | 254 } else if (context->image_is_valid_for_favicon_ && image_url.is_valid() && |
| 255 (image_url.SchemeIs(content::kHttpScheme) || | 255 (image_url.SchemeIs(content::kHttpScheme) || |
| 256 image_url.SchemeIs(content::kHttpsScheme))) { | 256 image_url.SchemeIs(content::kHttpsScheme))) { |
| 257 context->data_.favicon_url = image_url; | 257 context->data_.favicon_url = image_url; |
| 258 } | 258 } |
| 259 context->image_is_valid_for_favicon_ = false; | 259 context->image_is_valid_for_favicon_ = false; |
| 260 break; | 260 break; |
| 261 } | 261 } |
| 262 case TemplateURLParsingContext::INPUT_ENCODING: { | 262 case TemplateURLParsingContext::INPUT_ENCODING: { |
| 263 std::string input_encoding = UTF16ToASCII(context->string_); | 263 std::string input_encoding = base::UTF16ToASCII(context->string_); |
| 264 if (IsValidEncodingString(input_encoding)) | 264 if (IsValidEncodingString(input_encoding)) |
| 265 context->data_.input_encodings.push_back(input_encoding); | 265 context->data_.input_encodings.push_back(input_encoding); |
| 266 break; | 266 break; |
| 267 } | 267 } |
| 268 case TemplateURLParsingContext::URL: | 268 case TemplateURLParsingContext::URL: |
| 269 context->ProcessURLParams(); | 269 context->ProcessURLParams(); |
| 270 break; | 270 break; |
| 271 default: | 271 default: |
| 272 break; | 272 break; |
| 273 } | 273 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 memset(&sax_handler, 0, sizeof(sax_handler)); | 487 memset(&sax_handler, 0, sizeof(sax_handler)); |
| 488 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl; | 488 sax_handler.startElement = &TemplateURLParsingContext::StartElementImpl; |
| 489 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl; | 489 sax_handler.endElement = &TemplateURLParsingContext::EndElementImpl; |
| 490 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl; | 490 sax_handler.characters = &TemplateURLParsingContext::CharactersImpl; |
| 491 int error = xmlSAXUserParseMemory(&sax_handler, &context, data, | 491 int error = xmlSAXUserParseMemory(&sax_handler, &context, data, |
| 492 static_cast<int>(length)); | 492 static_cast<int>(length)); |
| 493 xmlSubstituteEntitiesDefault(last_sub_entities_value); | 493 xmlSubstituteEntitiesDefault(last_sub_entities_value); |
| 494 | 494 |
| 495 return error ? NULL : context.GetTemplateURL(profile, show_in_default_list); | 495 return error ? NULL : context.GetTemplateURL(profile, show_in_default_list); |
| 496 } | 496 } |
| OLD | NEW |