Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(776)

Side by Side Diff: chrome/browser/search_engines/template_url.cc

Issue 10332156: Add ability to set RLZ statically for OS_ANDROID (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Splitting android functions in prep for client id upload Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 TemplateURLRef::~TemplateURLRef() { 91 TemplateURLRef::~TemplateURLRef() {
92 } 92 }
93 93
94 std::string TemplateURLRef::GetURL() const { 94 std::string TemplateURLRef::GetURL() const {
95 switch (type_) { 95 switch (type_) {
96 case SEARCH: return owner_->url(); 96 case SEARCH: return owner_->url();
97 case SUGGEST: return owner_->suggestions_url(); 97 case SUGGEST: return owner_->suggestions_url();
98 case INSTANT: return owner_->instant_url(); 98 case INSTANT: return owner_->instant_url();
99 default: NOTREACHED(); return std::string(); 99 default:
100 NOTREACHED();
jcivelli 2012/05/15 00:16:59 Should be 2 space indent.
Isaac (away) 2012/05/15 00:21:47 Done.
101 return std::string();
100 } 102 }
101 } 103 }
102 104
103 bool TemplateURLRef::SupportsReplacement() const { 105 bool TemplateURLRef::SupportsReplacement() const {
104 UIThreadSearchTermsData search_terms_data(owner_->profile()); 106 UIThreadSearchTermsData search_terms_data(owner_->profile());
105 return SupportsReplacementUsingTermsData(search_terms_data); 107 return SupportsReplacementUsingTermsData(search_terms_data);
106 } 108 }
107 109
108 bool TemplateURLRef::SupportsReplacementUsingTermsData( 110 bool TemplateURLRef::SupportsReplacementUsingTermsData(
109 const SearchTermsData& search_terms_data) const { 111 const SearchTermsData& search_terms_data) const {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (accepted_suggestion >= 0) 208 if (accepted_suggestion >= 0)
207 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) + 209 url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) +
208 "&"); 210 "&");
209 break; 211 break;
210 212
211 case GOOGLE_RLZ: { 213 case GOOGLE_RLZ: {
212 // On platforms that don't have RLZ, we still want this branch 214 // On platforms that don't have RLZ, we still want this branch
213 // to happen so that we replace the RLZ template with the 215 // to happen so that we replace the RLZ template with the
214 // empty string. (If we don't handle this case, we hit a 216 // empty string. (If we don't handle this case, we hit a
215 // NOTREACHED below.) 217 // NOTREACHED below.)
216 #if defined(ENABLE_RLZ) 218 #if defined(ENABLE_RLZ) || defined(OS_ANDROID)
217 string16 rlz_string = search_terms_data.GetRlzParameterValue(); 219 string16 rlz_string = search_terms_data.GetRlzParameterValue();
218 if (!rlz_string.empty()) { 220 if (!rlz_string.empty()) {
219 url.insert(i->index, "rlz=" + UTF16ToUTF8(rlz_string) + "&"); 221 url.insert(i->index, "rlz=" + UTF16ToUTF8(rlz_string) + "&");
220 } 222 }
221 #endif 223 #endif
222 break; 224 break;
223 } 225 }
224 226
225 case GOOGLE_SEARCH_FIELDTRIAL_GROUP: 227 case GOOGLE_SEARCH_FIELDTRIAL_GROUP:
226 if (AutocompleteFieldTrial::InSuggestFieldTrial()) { 228 if (AutocompleteFieldTrial::InSuggestFieldTrial()) {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 data_.SetKeyword(TemplateURLService::GenerateKeyword(url)); 664 data_.SetKeyword(TemplateURLService::GenerateKeyword(url));
663 } 665 }
664 } 666 }
665 667
666 void TemplateURL::InvalidateCachedValues() { 668 void TemplateURL::InvalidateCachedValues() {
667 url_ref_.InvalidateCachedValues(); 669 url_ref_.InvalidateCachedValues();
668 suggestions_url_ref_.InvalidateCachedValues(); 670 suggestions_url_ref_.InvalidateCachedValues();
669 instant_url_ref_.InvalidateCachedValues(); 671 instant_url_ref_.InvalidateCachedValues();
670 ResetKeywordIfNecessary(false); 672 ResetKeywordIfNecessary(false);
671 } 673 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/search_terms_data.cc ('k') | chrome/browser/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698