OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/search_engines/template_url.h" |
6 | 6 |
7 #include "app/gfx/favicon_size.h" | 7 #include "app/gfx/favicon_size.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 ParseIfNecessary(); | 392 ParseIfNecessary(); |
393 return search_term_key_; | 393 return search_term_key_; |
394 } | 394 } |
395 | 395 |
396 std::wstring TemplateURLRef::SearchTermToWide(const TemplateURL& host, | 396 std::wstring TemplateURLRef::SearchTermToWide(const TemplateURL& host, |
397 const std::string& term) const { | 397 const std::string& term) const { |
398 const std::vector<std::string>& encodings = host.input_encodings(); | 398 const std::vector<std::string>& encodings = host.input_encodings(); |
399 std::wstring result; | 399 std::wstring result; |
400 | 400 |
401 std::string unescaped = | 401 std::string unescaped = |
402 UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE); | 402 UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE | |
| 403 UnescapeRule::URL_SPECIAL_CHARS); |
403 for (size_t i = 0; i < encodings.size(); ++i) { | 404 for (size_t i = 0; i < encodings.size(); ++i) { |
404 if (CodepageToWide(unescaped, encodings[i].c_str(), | 405 if (CodepageToWide(unescaped, encodings[i].c_str(), |
405 OnStringUtilConversionError::FAIL, &result)) | 406 OnStringUtilConversionError::FAIL, &result)) |
406 return result; | 407 return result; |
407 } | 408 } |
408 | 409 |
409 // Always fall back on UTF-8 if it works. | 410 // Always fall back on UTF-8 if it works. |
410 if (CodepageToWide(unescaped, "UTF-8", | 411 if (CodepageToWide(unescaped, "UTF-8", |
411 OnStringUtilConversionError::FAIL, &result)) | 412 OnStringUtilConversionError::FAIL, &result)) |
412 return result; | 413 return result; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } | 568 } |
568 return GURL(); | 569 return GURL(); |
569 } | 570 } |
570 | 571 |
571 void TemplateURL::InvalidateCachedValues() const { | 572 void TemplateURL::InvalidateCachedValues() const { |
572 url_.InvalidateCachedValues(); | 573 url_.InvalidateCachedValues(); |
573 suggestions_url_.InvalidateCachedValues(); | 574 suggestions_url_.InvalidateCachedValues(); |
574 if (autogenerate_keyword_) | 575 if (autogenerate_keyword_) |
575 keyword_.clear(); | 576 keyword_.clear(); |
576 } | 577 } |
OLD | NEW |