| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/string_number_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/google_url_tracker.h" | 14 #include "chrome/browser/google_url_tracker.h" |
| 14 #include "chrome/browser/search_engines/template_url_model.h" | 15 #include "chrome/browser/search_engines/template_url_model.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "gfx/favicon_size.h" | 17 #include "gfx/favicon_size.h" |
| 17 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 18 | 19 |
| 19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 20 #include "chrome/browser/rlz/rlz.h" | 21 #include "chrome/browser/rlz/rlz.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 std::string full_parameter(url->substr(start, end - start + 1)); | 103 std::string full_parameter(url->substr(start, end - start + 1)); |
| 103 // Remove the parameter from the string. | 104 // Remove the parameter from the string. |
| 104 url->erase(start, end - start + 1); | 105 url->erase(start, end - start + 1); |
| 105 if (parameter == kSearchTermsParameter) { | 106 if (parameter == kSearchTermsParameter) { |
| 106 replacements->push_back(Replacement(SEARCH_TERMS, start)); | 107 replacements->push_back(Replacement(SEARCH_TERMS, start)); |
| 107 } else if (parameter == kCountParameter) { | 108 } else if (parameter == kCountParameter) { |
| 108 if (!optional) | 109 if (!optional) |
| 109 url->insert(start, kDefaultCount); | 110 url->insert(start, kDefaultCount); |
| 110 } else if (parameter == kStartIndexParameter) { | 111 } else if (parameter == kStartIndexParameter) { |
| 111 if (!optional) { | 112 if (!optional) { |
| 112 url->insert(start, IntToString(index_offset_)); | 113 url->insert(start, base::IntToString(index_offset_)); |
| 113 } | 114 } |
| 114 } else if (parameter == kStartPageParameter) { | 115 } else if (parameter == kStartPageParameter) { |
| 115 if (!optional) { | 116 if (!optional) { |
| 116 url->insert(start, IntToString(page_offset_)); | 117 url->insert(start, base::IntToString(page_offset_)); |
| 117 } | 118 } |
| 118 } else if (parameter == kLanguageParameter) { | 119 } else if (parameter == kLanguageParameter) { |
| 119 replacements->push_back(Replacement(LANGUAGE, start)); | 120 replacements->push_back(Replacement(LANGUAGE, start)); |
| 120 } else if (parameter == kInputEncodingParameter) { | 121 } else if (parameter == kInputEncodingParameter) { |
| 121 replacements->push_back(Replacement(ENCODING, start)); | 122 replacements->push_back(Replacement(ENCODING, start)); |
| 122 } else if (parameter == kOutputEncodingParameter) { | 123 } else if (parameter == kOutputEncodingParameter) { |
| 123 if (!optional) | 124 if (!optional) |
| 124 url->insert(start, kOutputEncodingType); | 125 url->insert(start, kOutputEncodingType); |
| 125 } else if (parameter == kGoogleAcceptedSuggestionParameter) { | 126 } else if (parameter == kGoogleAcceptedSuggestionParameter) { |
| 126 replacements->push_back(Replacement(GOOGLE_ACCEPTED_SUGGESTION, start)); | 127 replacements->push_back(Replacement(GOOGLE_ACCEPTED_SUGGESTION, start)); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 } | 620 } |
| 620 | 621 |
| 621 std::string TemplateURL::GetExtensionId() const { | 622 std::string TemplateURL::GetExtensionId() const { |
| 622 DCHECK(IsExtensionKeyword()); | 623 DCHECK(IsExtensionKeyword()); |
| 623 return GURL(url_.url()).host(); | 624 return GURL(url_.url()).host(); |
| 624 } | 625 } |
| 625 | 626 |
| 626 bool TemplateURL::IsExtensionKeyword() const { | 627 bool TemplateURL::IsExtensionKeyword() const { |
| 627 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); | 628 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); |
| 628 } | 629 } |
| OLD | NEW |