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.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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (accepted_suggestion >= 0) | 390 if (accepted_suggestion >= 0) |
391 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) + | 391 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) + |
392 "&"); | 392 "&"); |
393 break; | 393 break; |
394 | 394 |
395 case GOOGLE_RLZ: { | 395 case GOOGLE_RLZ: { |
396 // On platforms that don't have RLZ, we still want this branch | 396 // On platforms that don't have RLZ, we still want this branch |
397 // to happen so that we replace the RLZ template with the | 397 // to happen so that we replace the RLZ template with the |
398 // empty string. (If we don't handle this case, we hit a | 398 // empty string. (If we don't handle this case, we hit a |
399 // NOTREACHED below.) | 399 // NOTREACHED below.) |
400 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 400 #if defined(ENABLE_RLZ) |
401 string16 rlz_string = search_terms_data.GetRlzParameterValue(); | 401 string16 rlz_string = search_terms_data.GetRlzParameterValue(); |
402 if (!rlz_string.empty()) { | 402 if (!rlz_string.empty()) { |
403 rlz_string = L"rlz=" + rlz_string + L"&"; | 403 url.insert(i->index, "rlz=" + UTF16ToUTF8(rlz_string) + "&"); |
404 url.insert(i->index, UTF16ToUTF8(rlz_string)); | |
405 } | 404 } |
406 #endif | 405 #endif |
407 break; | 406 break; |
408 } | 407 } |
409 | 408 |
410 case GOOGLE_SEARCH_FIELDTRIAL_GROUP: | 409 case GOOGLE_SEARCH_FIELDTRIAL_GROUP: |
411 // We are not curerntly running any fieldtrials that modulate the search | 410 // We are not curerntly running any fieldtrials that modulate the search |
412 // url. If we do, then we'd have some conditional insert such as: | 411 // url. If we do, then we'd have some conditional insert such as: |
413 // url.insert(i->index, used_www ? "gcx=w&" : "gcx=c&"); | 412 // url.insert(i->index, used_www ? "gcx=w&" : "gcx=c&"); |
414 break; | 413 break; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 783 } |
785 | 784 |
786 std::string TemplateURL::GetExtensionId() const { | 785 std::string TemplateURL::GetExtensionId() const { |
787 DCHECK(IsExtensionKeyword()); | 786 DCHECK(IsExtensionKeyword()); |
788 return GURL(url_.url()).host(); | 787 return GURL(url_.url()).host(); |
789 } | 788 } |
790 | 789 |
791 bool TemplateURL::IsExtensionKeyword() const { | 790 bool TemplateURL::IsExtensionKeyword() const { |
792 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); | 791 return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme); |
793 } | 792 } |
OLD | NEW |