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

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

Issue 11576044: Remove call to IsInstantExtendedAPIGoogleSearchUrl from ToolbarModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit Created 7 years, 11 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 // Gets the search URL at the given index. The alternate URLs, if any, are 467 // Gets the search URL at the given index. The alternate URLs, if any, are
468 // numbered starting at 0, and the primary search URL follows. This is used 468 // numbered starting at 0, and the primary search URL follows. This is used
469 // to decode the search term given a search URL (see 469 // to decode the search term given a search URL (see
470 // ExtractSearchTermsFromURL()). 470 // ExtractSearchTermsFromURL()).
471 const std::string& GetURL(size_t index) const; 471 const std::string& GetURL(size_t index) const;
472 472
473 // Use the alternate URLs and the search URL to match the provided |url| 473 // Use the alternate URLs and the search URL to match the provided |url|
474 // and extract |search_terms| from it. Returns false and an empty 474 // and extract |search_terms| from it. Returns false and an empty
475 // |search_terms| if no search terms can be matched. The order in which the 475 // |search_terms| if no search terms can be matched. The order in which the
476 // alternate URLs are listed dictates their priority, the URL at index 0 476 // alternate URLs are listed dictates their priority, the URL at index 0 is
477 // is treated as the highest priority and the primary search URL is treated 477 // treated as the highest priority and the primary search URL is treated as
478 // as the lowest priority (see GetURL()). For example, if a TemplateURL has 478 // the lowest priority (see GetURL()). For example, if a TemplateURL has
479 // alternate URL "http://foo/#q={searchTerms}" and search URL 479 // alternate URL "http://foo/#q={searchTerms}" and search URL
480 // "http://foo/?q={searchTerms}", and the URL to be decoded is 480 // "http://foo/?q={searchTerms}", and the URL to be decoded is
481 // "http://foo/?q=a#q=b", the alternate URL will match first and the decoded 481 // "http://foo/?q=a#q=b", the alternate URL will match first and the decoded
482 // search term will be "b". 482 // search term will be "b".
483 bool ExtractSearchTermsFromURL(const GURL& url, string16* search_terms); 483 bool ExtractSearchTermsFromURL(const GURL& url, string16* search_terms);
484 484
485 // Returns true if the specified |url| contains the search terms replacement
486 // key in either the query or the ref. This method does not verify anything
487 // else about the URL. In particular, it does not check that the domain
488 // matches that of this TemplateURL.
489 bool HasSearchTermsReplacementKey(const GURL& url) const;
490
485 private: 491 private:
486 friend class TemplateURLService; 492 friend class TemplateURLService;
487 493
488 void CopyFrom(const TemplateURL& other); 494 void CopyFrom(const TemplateURL& other);
489 495
490 void SetURL(const std::string& url); 496 void SetURL(const std::string& url);
491 void SetPrepopulateId(int id); 497 void SetPrepopulateId(int id);
492 498
493 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. 499 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|.
494 // The |force| parameter is useful when the existing keyword is known to be 500 // The |force| parameter is useful when the existing keyword is known to be
495 // a placeholder. The resulting keyword is generated using 501 // a placeholder. The resulting keyword is generated using
496 // TemplateURLService::GenerateSearchURL() and 502 // TemplateURLService::GenerateSearchURL() and
497 // TemplateURLService::GenerateKeyword(). 503 // TemplateURLService::GenerateKeyword().
498 void ResetKeywordIfNecessary(bool force); 504 void ResetKeywordIfNecessary(bool force);
499 505
500 Profile* profile_; 506 Profile* profile_;
501 TemplateURLData data_; 507 TemplateURLData data_;
502 TemplateURLRef url_ref_; 508 TemplateURLRef url_ref_;
503 TemplateURLRef suggestions_url_ref_; 509 TemplateURLRef suggestions_url_ref_;
504 TemplateURLRef instant_url_ref_; 510 TemplateURLRef instant_url_ref_;
505 511
506 // TODO(sky): Add date last parsed OSD file. 512 // TODO(sky): Add date last parsed OSD file.
507 513
508 DISALLOW_COPY_AND_ASSIGN(TemplateURL); 514 DISALLOW_COPY_AND_ASSIGN(TemplateURL);
509 }; 515 };
510 516
511 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 517 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/prepopulated_engines_schema.json ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698