| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 base::Time last_modified() const { return data_.last_modified; } | 424 base::Time last_modified() const { return data_.last_modified; } |
| 425 | 425 |
| 426 bool created_by_policy() const { return data_.created_by_policy; } | 426 bool created_by_policy() const { return data_.created_by_policy; } |
| 427 | 427 |
| 428 int usage_count() const { return data_.usage_count; } | 428 int usage_count() const { return data_.usage_count; } |
| 429 | 429 |
| 430 int prepopulate_id() const { return data_.prepopulate_id; } | 430 int prepopulate_id() const { return data_.prepopulate_id; } |
| 431 | 431 |
| 432 const std::string& sync_guid() const { return data_.sync_guid; } | 432 const std::string& sync_guid() const { return data_.sync_guid; } |
| 433 | 433 |
| 434 // TODO(beaudoin): Rename this when renaming HasSearchTermsReplacementKey(). |
| 434 const std::string& search_terms_replacement_key() const { | 435 const std::string& search_terms_replacement_key() const { |
| 435 return data_.search_terms_replacement_key; | 436 return data_.search_terms_replacement_key; |
| 436 } | 437 } |
| 437 | 438 |
| 438 const TemplateURLRef& url_ref() const { return url_ref_; } | 439 const TemplateURLRef& url_ref() const { return url_ref_; } |
| 439 const TemplateURLRef& suggestions_url_ref() const { | 440 const TemplateURLRef& suggestions_url_ref() const { |
| 440 return suggestions_url_ref_; | 441 return suggestions_url_ref_; |
| 441 } | 442 } |
| 442 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } | 443 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } |
| 443 | 444 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // alternate URL "http://foo/#q={searchTerms}" and search URL | 480 // alternate URL "http://foo/#q={searchTerms}" and search URL |
| 480 // "http://foo/?q={searchTerms}", and the URL to be decoded is | 481 // "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 | 482 // "http://foo/?q=a#q=b", the alternate URL will match first and the decoded |
| 482 // search term will be "b". | 483 // search term will be "b". |
| 483 bool ExtractSearchTermsFromURL(const GURL& url, string16* search_terms); | 484 bool ExtractSearchTermsFromURL(const GURL& url, string16* search_terms); |
| 484 | 485 |
| 485 // Returns true if the specified |url| contains the search terms replacement | 486 // 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 // 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 // else about the URL. In particular, it does not check that the domain |
| 488 // matches that of this TemplateURL. | 489 // matches that of this TemplateURL. |
| 490 // TODO(beaudoin): Rename this to reflect that it really checks for an |
| 491 // InstantExtended capable URL. |
| 489 bool HasSearchTermsReplacementKey(const GURL& url) const; | 492 bool HasSearchTermsReplacementKey(const GURL& url) const; |
| 490 | 493 |
| 491 private: | 494 private: |
| 492 friend class TemplateURLService; | 495 friend class TemplateURLService; |
| 493 | 496 |
| 494 void CopyFrom(const TemplateURL& other); | 497 void CopyFrom(const TemplateURL& other); |
| 495 | 498 |
| 496 void SetURL(const std::string& url); | 499 void SetURL(const std::string& url); |
| 497 void SetPrepopulateId(int id); | 500 void SetPrepopulateId(int id); |
| 498 | 501 |
| 499 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. | 502 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. |
| 500 // The |force| parameter is useful when the existing keyword is known to be | 503 // The |force| parameter is useful when the existing keyword is known to be |
| 501 // a placeholder. The resulting keyword is generated using | 504 // a placeholder. The resulting keyword is generated using |
| 502 // TemplateURLService::GenerateSearchURL() and | 505 // TemplateURLService::GenerateSearchURL() and |
| 503 // TemplateURLService::GenerateKeyword(). | 506 // TemplateURLService::GenerateKeyword(). |
| 504 void ResetKeywordIfNecessary(bool force); | 507 void ResetKeywordIfNecessary(bool force); |
| 505 | 508 |
| 506 Profile* profile_; | 509 Profile* profile_; |
| 507 TemplateURLData data_; | 510 TemplateURLData data_; |
| 508 TemplateURLRef url_ref_; | 511 TemplateURLRef url_ref_; |
| 509 TemplateURLRef suggestions_url_ref_; | 512 TemplateURLRef suggestions_url_ref_; |
| 510 TemplateURLRef instant_url_ref_; | 513 TemplateURLRef instant_url_ref_; |
| 511 | 514 |
| 512 // TODO(sky): Add date last parsed OSD file. | 515 // TODO(sky): Add date last parsed OSD file. |
| 513 | 516 |
| 514 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 517 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 515 }; | 518 }; |
| 516 | 519 |
| 517 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 520 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |