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

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

Issue 22945004: InstantExtended: Add new_tab_url to TemplateURL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 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 | Annotate | Revision Log
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 TemplateURLRef::~TemplateURLRef() { 232 TemplateURLRef::~TemplateURLRef() {
233 } 233 }
234 234
235 std::string TemplateURLRef::GetURL() const { 235 std::string TemplateURLRef::GetURL() const {
236 switch (type_) { 236 switch (type_) {
237 case SEARCH: return owner_->url(); 237 case SEARCH: return owner_->url();
238 case SUGGEST: return owner_->suggestions_url(); 238 case SUGGEST: return owner_->suggestions_url();
239 case INSTANT: return owner_->instant_url(); 239 case INSTANT: return owner_->instant_url();
240 case IMAGE: return owner_->image_url(); 240 case IMAGE: return owner_->image_url();
241 case NEW_TAB: return owner_->new_tab_url();
241 case INDEXED: return owner_->GetURL(index_in_owner_); 242 case INDEXED: return owner_->GetURL(index_in_owner_);
242 default: NOTREACHED(); return std::string(); // NOLINT 243 default: NOTREACHED(); return std::string(); // NOLINT
243 } 244 }
244 } 245 }
245 246
246 std::string TemplateURLRef::GetPostParamsString() const { 247 std::string TemplateURLRef::GetPostParamsString() const {
247 switch (type_) { 248 switch (type_) {
248 case INDEXED: 249 case INDEXED:
249 case SEARCH: return owner_->search_url_post_params(); 250 case SEARCH: return owner_->search_url_post_params();
250 case SUGGEST: return owner_->suggestions_url_post_params(); 251 case SUGGEST: return owner_->suggestions_url_post_params();
251 case INSTANT: return owner_->instant_url_post_params(); 252 case INSTANT: return owner_->instant_url_post_params();
253 case NEW_TAB: return std::string();
252 case IMAGE: return owner_->image_url_post_params(); 254 case IMAGE: return owner_->image_url_post_params();
253 default: NOTREACHED(); return std::string(); // NOLINT 255 default: NOTREACHED(); return std::string(); // NOLINT
254 } 256 }
255 } 257 }
256 258
257 bool TemplateURLRef::UsesPOSTMethodUsingTermsData( 259 bool TemplateURLRef::UsesPOSTMethodUsingTermsData(
258 const SearchTermsData* search_terms_data) const { 260 const SearchTermsData* search_terms_data) const {
259 if (search_terms_data) 261 if (search_terms_data)
260 ParseIfNecessaryUsingTermsData(*search_terms_data); 262 ParseIfNecessaryUsingTermsData(*search_terms_data);
261 else 263 else
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 // TemplateURL ---------------------------------------------------------------- 1004 // TemplateURL ----------------------------------------------------------------
1003 1005
1004 TemplateURL::TemplateURL(Profile* profile, const TemplateURLData& data) 1006 TemplateURL::TemplateURL(Profile* profile, const TemplateURLData& data)
1005 : profile_(profile), 1007 : profile_(profile),
1006 data_(data), 1008 data_(data),
1007 url_ref_(this, TemplateURLRef::SEARCH), 1009 url_ref_(this, TemplateURLRef::SEARCH),
1008 suggestions_url_ref_(this, 1010 suggestions_url_ref_(this,
1009 TemplateURLRef::SUGGEST), 1011 TemplateURLRef::SUGGEST),
1010 instant_url_ref_(this, 1012 instant_url_ref_(this,
1011 TemplateURLRef::INSTANT), 1013 TemplateURLRef::INSTANT),
1012 image_url_ref_(this, TemplateURLRef::IMAGE) { 1014 image_url_ref_(this, TemplateURLRef::IMAGE),
1015 new_tab_url_ref_(this, TemplateURLRef::NEW_TAB) {
1013 SetPrepopulateId(data_.prepopulate_id); 1016 SetPrepopulateId(data_.prepopulate_id);
1014 1017
1015 if (data_.search_terms_replacement_key == 1018 if (data_.search_terms_replacement_key ==
1016 kGoogleInstantExtendedEnabledKeyFull) { 1019 kGoogleInstantExtendedEnabledKeyFull) {
1017 data_.search_terms_replacement_key = google_util::kInstantExtendedAPIParam; 1020 data_.search_terms_replacement_key = google_util::kInstantExtendedAPIParam;
1018 } 1021 }
1019 } 1022 }
1020 1023
1021 TemplateURL::~TemplateURL() { 1024 TemplateURL::~TemplateURL() {
1022 } 1025 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 // patterns. This means that given patterns 1255 // patterns. This means that given patterns
1253 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], 1256 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ],
1254 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would 1257 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would
1255 // return false. This is important for at least Google, where such URLs 1258 // return false. This is important for at least Google, where such URLs
1256 // are invalid. 1259 // are invalid.
1257 return !search_terms->empty(); 1260 return !search_terms->empty();
1258 } 1261 }
1259 } 1262 }
1260 return false; 1263 return false;
1261 } 1264 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_prepopulate_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698