Chromium Code Reviews| 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 #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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // the key of the search term, otherwise this returns an empty string. | 129 // the key of the search term, otherwise this returns an empty string. |
| 130 const std::string& GetSearchTermKey() const; | 130 const std::string& GetSearchTermKey() const; |
| 131 | 131 |
| 132 // Converts the specified term in our owner's encoding to a string16. | 132 // Converts the specified term in our owner's encoding to a string16. |
| 133 string16 SearchTermToString16(const std::string& term) const; | 133 string16 SearchTermToString16(const std::string& term) const; |
| 134 | 134 |
| 135 // Returns true if this TemplateURLRef has a replacement term of | 135 // Returns true if this TemplateURLRef has a replacement term of |
| 136 // {google:baseURL} or {google:baseSuggestURL}. | 136 // {google:baseURL} or {google:baseSuggestURL}. |
| 137 bool HasGoogleBaseURLs() const; | 137 bool HasGoogleBaseURLs() const; |
| 138 | 138 |
| 139 // Returns true if this TemplateURLRef has a replacement term of | |
| 140 // {google:instantExtendedEnabledParameter}. | |
| 141 bool HasGoogleInstantExtendedParam() const; | |
|
beaudoin
2013/01/15 00:34:55
In the current case you should be able to use Temp
Jered
2013/01/15 19:06:28
I'm confused. Should supporting search terms repla
dhollowa
2013/01/15 19:18:55
Yes, this conflation of the two notions of instant
| |
| 142 | |
| 139 // Use the pattern referred to by this TemplateURLRef to match the provided | 143 // Use the pattern referred to by this TemplateURLRef to match the provided |
| 140 // |url| and extract |search_terms| from it. Returns true if the pattern | 144 // |url| and extract |search_terms| from it. Returns true if the pattern |
| 141 // matches, even if |search_terms| is empty. Returns false and an empty | 145 // matches, even if |search_terms| is empty. Returns false and an empty |
| 142 // |search_terms| if the pattern does not match. | 146 // |search_terms| if the pattern does not match. |
| 143 bool ExtractSearchTermsFromURL(const GURL& url, | 147 bool ExtractSearchTermsFromURL(const GURL& url, |
| 144 string16* search_terms) const; | 148 string16* search_terms) const; |
| 145 | 149 |
| 146 private: | 150 private: |
| 147 friend class TemplateURL; | 151 friend class TemplateURL; |
| 148 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); | 152 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 | 450 |
| 447 // Like SupportsReplacement but usable on threads other than the UI thread. | 451 // Like SupportsReplacement but usable on threads other than the UI thread. |
| 448 bool SupportsReplacementUsingTermsData( | 452 bool SupportsReplacementUsingTermsData( |
| 449 const SearchTermsData& search_terms_data) const; | 453 const SearchTermsData& search_terms_data) const; |
| 450 | 454 |
| 451 // Returns true if this TemplateURL uses Google base URLs and has a keyword | 455 // Returns true if this TemplateURL uses Google base URLs and has a keyword |
| 452 // of "google.TLD". We use this to decide whether we can automatically | 456 // of "google.TLD". We use this to decide whether we can automatically |
| 453 // update the keyword to reflect the current Google base URL TLD. | 457 // update the keyword to reflect the current Google base URL TLD. |
| 454 bool IsGoogleSearchURLWithReplaceableKeyword() const; | 458 bool IsGoogleSearchURLWithReplaceableKeyword() const; |
| 455 | 459 |
| 460 // Returns true if the instant_url for this TemplateURL has a replacement for | |
| 461 // enabling Instant Extended. | |
| 462 bool SupportsInstantExtendedParam() const; | |
| 463 | |
| 456 // Returns true if the keywords match or if | 464 // Returns true if the keywords match or if |
| 457 // IsGoogleSearchURLWithReplaceableKeyword() is true for both TemplateURLs. | 465 // IsGoogleSearchURLWithReplaceableKeyword() is true for both TemplateURLs. |
| 458 bool HasSameKeywordAs(const TemplateURL& other) const; | 466 bool HasSameKeywordAs(const TemplateURL& other) const; |
| 459 | 467 |
| 460 std::string GetExtensionId() const; | 468 std::string GetExtensionId() const; |
| 461 bool IsExtensionKeyword() const; | 469 bool IsExtensionKeyword() const; |
| 462 | 470 |
| 463 // Returns the total number of URLs comprised in this template, including | 471 // Returns the total number of URLs comprised in this template, including |
| 464 // search and alternate URLs. | 472 // search and alternate URLs. |
| 465 size_t URLCount() const; | 473 size_t URLCount() const; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 TemplateURLRef url_ref_; | 516 TemplateURLRef url_ref_; |
| 509 TemplateURLRef suggestions_url_ref_; | 517 TemplateURLRef suggestions_url_ref_; |
| 510 TemplateURLRef instant_url_ref_; | 518 TemplateURLRef instant_url_ref_; |
| 511 | 519 |
| 512 // TODO(sky): Add date last parsed OSD file. | 520 // TODO(sky): Add date last parsed OSD file. |
| 513 | 521 |
| 514 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 522 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 515 }; | 523 }; |
| 516 | 524 |
| 517 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 525 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |