| 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. | |
| 425 static bool use_suggest_prefix = | 424 static bool use_suggest_prefix = |
| 426 base::FieldTrialList::TrialExists("SuggestHostPrefix"); | 425 base::FieldTrialList::TrialExists("SuggestHostPrefix"); |
| 427 if (use_suggest_prefix) { | 426 if (use_suggest_prefix) { |
| 428 static bool used_www = (base::FieldTrialList::FindFullName( | 427 static bool used_www = (base::FieldTrialList::FindFullName( |
| 429 "SuggestHostPrefix") == "Www_Prefix"); | 428 "SuggestHostPrefix") == "Www_Prefix"); |
| 430 url.insert(i->index, used_www ? "cx=w&" : "cx=c&"); | 429 url.insert(i->index, used_www ? "gcx=w&" : "gcx=c&"); |
| 431 } | 430 } |
| 432 #endif // 0 | |
| 433 break; | 431 break; |
| 434 } | 432 } |
| 435 | 433 |
| 436 case GOOGLE_UNESCAPED_SEARCH_TERMS: { | 434 case GOOGLE_UNESCAPED_SEARCH_TERMS: { |
| 437 std::string unescaped_terms; | 435 std::string unescaped_terms; |
| 438 base::UTF16ToCodepage(terms, input_encoding.c_str(), | 436 base::UTF16ToCodepage(terms, input_encoding.c_str(), |
| 439 base::OnStringConversionError::SKIP, | 437 base::OnStringConversionError::SKIP, |
| 440 &unescaped_terms); | 438 &unescaped_terms); |
| 441 url.insert(i->index, std::string(unescaped_terms.begin(), | 439 url.insert(i->index, std::string(unescaped_terms.begin(), |
| 442 unescaped_terms.end())); | 440 unescaped_terms.end())); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 751 } |
| 754 | 752 |
| 755 std::string TemplateURL::GetExtensionId() const { | 753 std::string TemplateURL::GetExtensionId() const { |
| 756 DCHECK(IsExtensionKeyword()); | 754 DCHECK(IsExtensionKeyword()); |
| 757 return GURL(url_.url()).host(); | 755 return GURL(url_.url()).host(); |
| 758 } | 756 } |
| 759 | 757 |
| 760 bool TemplateURL::IsExtensionKeyword() const { | 758 bool TemplateURL::IsExtensionKeyword() const { |
| 761 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); | 759 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); |
| 762 } | 760 } |
| OLD | NEW |