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 <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Which kind of URL within our owner we are. This allows us to get at the | 45 // Which kind of URL within our owner we are. This allows us to get at the |
| 46 // correct string field. Use |INDEXED| to indicate that the numerical | 46 // correct string field. Use |INDEXED| to indicate that the numerical |
| 47 // |index_in_owner_| should be used instead. | 47 // |index_in_owner_| should be used instead. |
| 48 enum Type { | 48 enum Type { |
| 49 SEARCH, | 49 SEARCH, |
| 50 SUGGEST, | 50 SUGGEST, |
| 51 INSTANT, | 51 INSTANT, |
| 52 IMAGE, | 52 IMAGE, |
| 53 INDEXED | 53 INDEXED, |
| 54 NEW_TAB | |
|
samarth
2013/08/13 23:47:59
I think INDEXED should be last.
Jered
2013/08/14 15:41:49
Done.
| |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Type to store <content_type, post_data> pair for POST URLs. | 57 // Type to store <content_type, post_data> pair for POST URLs. |
| 57 // The |content_type|(first part of the pair) is the content-type of | 58 // The |content_type|(first part of the pair) is the content-type of |
| 58 // the |post_data|(second part of the pair) which is encoded in | 59 // the |post_data|(second part of the pair) which is encoded in |
| 59 // "multipart/form-data" format, it also contains the MIME boundary used in | 60 // "multipart/form-data" format, it also contains the MIME boundary used in |
| 60 // the |post_data|. See http://tools.ietf.org/html/rfc2046 for the details. | 61 // the |post_data|. See http://tools.ietf.org/html/rfc2046 for the details. |
| 61 typedef std::pair<std::string, std::string> PostContent; | 62 typedef std::pair<std::string, std::string> PostContent; |
| 62 | 63 |
| 63 // This struct encapsulates arguments passed to | 64 // This struct encapsulates arguments passed to |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 402 |
| 402 // The raw URL for the TemplateURL, which may not be valid as-is (e.g. because | 403 // The raw URL for the TemplateURL, which may not be valid as-is (e.g. because |
| 403 // it requires substitutions first). This must be non-empty. | 404 // it requires substitutions first). This must be non-empty. |
| 404 void SetURL(const std::string& url); | 405 void SetURL(const std::string& url); |
| 405 const std::string& url() const { return url_; } | 406 const std::string& url() const { return url_; } |
| 406 | 407 |
| 407 // Optional additional raw URLs. | 408 // Optional additional raw URLs. |
| 408 std::string suggestions_url; | 409 std::string suggestions_url; |
| 409 std::string instant_url; | 410 std::string instant_url; |
| 410 std::string image_url; | 411 std::string image_url; |
| 412 std::string new_tab_url; | |
| 411 | 413 |
| 412 // The following post_params are comma-separated lists used to specify the | 414 // The following post_params are comma-separated lists used to specify the |
| 413 // post parameters for the corresponding URL. | 415 // post parameters for the corresponding URL. |
| 414 std::string search_url_post_params; | 416 std::string search_url_post_params; |
| 415 std::string suggestions_url_post_params; | 417 std::string suggestions_url_post_params; |
| 416 std::string instant_url_post_params; | 418 std::string instant_url_post_params; |
| 417 std::string image_url_post_params; | 419 std::string image_url_post_params; |
| 418 | 420 |
| 419 // Optional favicon for the TemplateURL. | 421 // Optional favicon for the TemplateURL. |
| 420 GURL favicon_url; | 422 GURL favicon_url; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 // An accessor for the short_name, but adjusted so it can be appropriately | 520 // An accessor for the short_name, but adjusted so it can be appropriately |
| 519 // displayed even if it is LTR and the UI is RTL. | 521 // displayed even if it is LTR and the UI is RTL. |
| 520 string16 AdjustedShortNameForLocaleDirection() const; | 522 string16 AdjustedShortNameForLocaleDirection() const; |
| 521 | 523 |
| 522 const string16& keyword() const { return data_.keyword(); } | 524 const string16& keyword() const { return data_.keyword(); } |
| 523 | 525 |
| 524 const std::string& url() const { return data_.url(); } | 526 const std::string& url() const { return data_.url(); } |
| 525 const std::string& suggestions_url() const { return data_.suggestions_url; } | 527 const std::string& suggestions_url() const { return data_.suggestions_url; } |
| 526 const std::string& instant_url() const { return data_.instant_url; } | 528 const std::string& instant_url() const { return data_.instant_url; } |
| 527 const std::string& image_url() const { return data_.image_url; } | 529 const std::string& image_url() const { return data_.image_url; } |
| 530 const std::string& new_tab_url() const { return data_.new_tab_url; } | |
| 528 const std::string& search_url_post_params() const { | 531 const std::string& search_url_post_params() const { |
| 529 return data_.search_url_post_params; | 532 return data_.search_url_post_params; |
| 530 } | 533 } |
| 531 const std::string& suggestions_url_post_params() const { | 534 const std::string& suggestions_url_post_params() const { |
| 532 return data_.suggestions_url_post_params; | 535 return data_.suggestions_url_post_params; |
| 533 } | 536 } |
| 534 const std::string& instant_url_post_params() const { | 537 const std::string& instant_url_post_params() const { |
| 535 return data_.instant_url_post_params; | 538 return data_.instant_url_post_params; |
| 536 } | 539 } |
| 537 const std::string& image_url_post_params() const { | 540 const std::string& image_url_post_params() const { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 const std::string& search_terms_replacement_key() const { | 575 const std::string& search_terms_replacement_key() const { |
| 573 return data_.search_terms_replacement_key; | 576 return data_.search_terms_replacement_key; |
| 574 } | 577 } |
| 575 | 578 |
| 576 const TemplateURLRef& url_ref() const { return url_ref_; } | 579 const TemplateURLRef& url_ref() const { return url_ref_; } |
| 577 const TemplateURLRef& suggestions_url_ref() const { | 580 const TemplateURLRef& suggestions_url_ref() const { |
| 578 return suggestions_url_ref_; | 581 return suggestions_url_ref_; |
| 579 } | 582 } |
| 580 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } | 583 const TemplateURLRef& instant_url_ref() const { return instant_url_ref_; } |
| 581 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } | 584 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } |
| 585 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } | |
| 582 | 586 |
| 583 // Returns true if |url| supports replacement. | 587 // Returns true if |url| supports replacement. |
| 584 bool SupportsReplacement() const; | 588 bool SupportsReplacement() const; |
| 585 | 589 |
| 586 // Like SupportsReplacement but usable on threads other than the UI thread. | 590 // Like SupportsReplacement but usable on threads other than the UI thread. |
| 587 bool SupportsReplacementUsingTermsData( | 591 bool SupportsReplacementUsingTermsData( |
| 588 const SearchTermsData& search_terms_data) const; | 592 const SearchTermsData& search_terms_data) const; |
| 589 | 593 |
| 590 // Returns true if this TemplateURL uses Google base URLs and has a keyword | 594 // Returns true if this TemplateURL uses Google base URLs and has a keyword |
| 591 // of "google.TLD". We use this to decide whether we can automatically | 595 // of "google.TLD". We use this to decide whether we can automatically |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 string16* search_terms, | 697 string16* search_terms, |
| 694 url_parse::Parsed::ComponentType* search_terms_component, | 698 url_parse::Parsed::ComponentType* search_terms_component, |
| 695 url_parse::Component* search_terms_position); | 699 url_parse::Component* search_terms_position); |
| 696 | 700 |
| 697 Profile* profile_; | 701 Profile* profile_; |
| 698 TemplateURLData data_; | 702 TemplateURLData data_; |
| 699 TemplateURLRef url_ref_; | 703 TemplateURLRef url_ref_; |
| 700 TemplateURLRef suggestions_url_ref_; | 704 TemplateURLRef suggestions_url_ref_; |
| 701 TemplateURLRef instant_url_ref_; | 705 TemplateURLRef instant_url_ref_; |
| 702 TemplateURLRef image_url_ref_; | 706 TemplateURLRef image_url_ref_; |
| 707 TemplateURLRef new_tab_url_ref_; | |
| 703 | 708 |
| 704 // TODO(sky): Add date last parsed OSD file. | 709 // TODO(sky): Add date last parsed OSD file. |
| 705 | 710 |
| 706 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 711 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 707 }; | 712 }; |
| 708 | 713 |
| 709 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 714 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |