| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.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" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 string16 rlz_string = search_terms_data.GetRlzParameterValue(); | 414 string16 rlz_string = search_terms_data.GetRlzParameterValue(); |
| 415 if (!rlz_string.empty()) { | 415 if (!rlz_string.empty()) { |
| 416 rlz_string = L"rlz=" + rlz_string + L"&"; | 416 rlz_string = L"rlz=" + rlz_string + L"&"; |
| 417 url.insert(i->index, UTF16ToUTF8(rlz_string)); | 417 url.insert(i->index, UTF16ToUTF8(rlz_string)); |
| 418 } | 418 } |
| 419 #endif | 419 #endif |
| 420 break; | 420 break; |
| 421 } | 421 } |
| 422 | 422 |
| 423 case GOOGLE_SEARCH_FIELDTRIAL_GROUP: { | 423 case GOOGLE_SEARCH_FIELDTRIAL_GROUP: { |
| 424 #if 0 // Disable until a decision is made about what parameter to use. |
| 424 static bool use_suggest_prefix = | 425 static bool use_suggest_prefix = |
| 425 base::FieldTrialList::TrialExists("SuggestHostPrefix"); | 426 base::FieldTrialList::TrialExists("SuggestHostPrefix"); |
| 426 if (use_suggest_prefix) { | 427 if (use_suggest_prefix) { |
| 427 static bool used_www = (base::FieldTrialList::FindFullName( | 428 static bool used_www = (base::FieldTrialList::FindFullName( |
| 428 "SuggestHostPrefix") == "Www_Prefix"); | 429 "SuggestHostPrefix") == "Www_Prefix"); |
| 429 url.insert(i->index, used_www ? "cx=w&" : "cx=c&"); | 430 url.insert(i->index, used_www ? "cx=w&" : "cx=c&"); |
| 430 } | 431 } |
| 432 #endif // 0 |
| 431 break; | 433 break; |
| 432 } | 434 } |
| 433 | 435 |
| 434 case GOOGLE_UNESCAPED_SEARCH_TERMS: { | 436 case GOOGLE_UNESCAPED_SEARCH_TERMS: { |
| 435 std::string unescaped_terms; | 437 std::string unescaped_terms; |
| 436 base::UTF16ToCodepage(terms, input_encoding.c_str(), | 438 base::UTF16ToCodepage(terms, input_encoding.c_str(), |
| 437 base::OnStringConversionError::SKIP, | 439 base::OnStringConversionError::SKIP, |
| 438 &unescaped_terms); | 440 &unescaped_terms); |
| 439 url.insert(i->index, std::string(unescaped_terms.begin(), | 441 url.insert(i->index, std::string(unescaped_terms.begin(), |
| 440 unescaped_terms.end())); | 442 unescaped_terms.end())); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 } | 753 } |
| 752 | 754 |
| 753 std::string TemplateURL::GetExtensionId() const { | 755 std::string TemplateURL::GetExtensionId() const { |
| 754 DCHECK(IsExtensionKeyword()); | 756 DCHECK(IsExtensionKeyword()); |
| 755 return GURL(url_.url()).host(); | 757 return GURL(url_.url()).host(); |
| 756 } | 758 } |
| 757 | 759 |
| 758 bool TemplateURL::IsExtensionKeyword() const { | 760 bool TemplateURL::IsExtensionKeyword() const { |
| 759 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); | 761 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); |
| 760 } | 762 } |
| OLD | NEW |