| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 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 | 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 | 487 // else about the URL. In particular, it does not check that the domain |
| 488 // matches that of this TemplateURL. | 488 // matches that of this TemplateURL. |
| 489 // TODO(beaudoin): Rename this to reflect that it really checks for an |
| 490 // InstantExtended capable URL. |
| 489 bool HasSearchTermsReplacementKey(const GURL& url) const; | 491 bool HasSearchTermsReplacementKey(const GURL& url) const; |
| 490 | 492 |
| 491 private: | 493 private: |
| 492 friend class TemplateURLService; | 494 friend class TemplateURLService; |
| 493 | 495 |
| 494 void CopyFrom(const TemplateURL& other); | 496 void CopyFrom(const TemplateURL& other); |
| 495 | 497 |
| 496 void SetURL(const std::string& url); | 498 void SetURL(const std::string& url); |
| 497 void SetPrepopulateId(int id); | 499 void SetPrepopulateId(int id); |
| 498 | 500 |
| 499 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. | 501 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. |
| 500 // The |force| parameter is useful when the existing keyword is known to be | 502 // The |force| parameter is useful when the existing keyword is known to be |
| 501 // a placeholder. The resulting keyword is generated using | 503 // a placeholder. The resulting keyword is generated using |
| 502 // TemplateURLService::GenerateSearchURL() and | 504 // TemplateURLService::GenerateSearchURL() and |
| 503 // TemplateURLService::GenerateKeyword(). | 505 // TemplateURLService::GenerateKeyword(). |
| 504 void ResetKeywordIfNecessary(bool force); | 506 void ResetKeywordIfNecessary(bool force); |
| 505 | 507 |
| 506 Profile* profile_; | 508 Profile* profile_; |
| 507 TemplateURLData data_; | 509 TemplateURLData data_; |
| 508 TemplateURLRef url_ref_; | 510 TemplateURLRef url_ref_; |
| 509 TemplateURLRef suggestions_url_ref_; | 511 TemplateURLRef suggestions_url_ref_; |
| 510 TemplateURLRef instant_url_ref_; | 512 TemplateURLRef instant_url_ref_; |
| 511 | 513 |
| 512 // TODO(sky): Add date last parsed OSD file. | 514 // TODO(sky): Add date last parsed OSD file. |
| 513 | 515 |
| 514 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 516 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 515 }; | 517 }; |
| 516 | 518 |
| 517 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 519 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |