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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 // to align the preview contents with the omnibox. | 94 // to align the preview contents with the omnibox. |
95 int omnibox_start_margin; | 95 int omnibox_start_margin; |
96 | 96 |
97 // The URL of the current webpage to be used for experimental zero-prefix | 97 // The URL of the current webpage to be used for experimental zero-prefix |
98 // suggestions. | 98 // suggestions. |
99 std::string zero_prefix_url; | 99 std::string zero_prefix_url; |
100 | 100 |
101 // Which omnibox the user used to type the prefix. | 101 // Which omnibox the user used to type the prefix. |
102 AutocompleteInput::PageClassification page_classification; | 102 AutocompleteInput::PageClassification page_classification; |
103 | 103 |
104 // True for searches issued with the bookmark bar pref set to shown. | |
105 bool bookmark_bar_pinned; | |
106 | |
104 // If set, ReplaceSearchTerms() will automatically append any extra query | 107 // If set, ReplaceSearchTerms() will automatically append any extra query |
105 // params specified via the --extra-search-query-params command-line | 108 // params specified via the --extra-search-query-params command-line |
106 // argument. Generally, this should be set when dealing with the search or | 109 // argument. Generally, this should be set when dealing with the search or |
107 // instant TemplateURLRefs of the default search engine and the caller cares | 110 // instant TemplateURLRefs of the default search engine and the caller cares |
108 // about the query portion of the URL. Since neither TemplateURLRef nor | 111 // about the query portion of the URL. Since neither TemplateURLRef nor |
109 // indeed TemplateURL know whether a TemplateURL is the default search | 112 // indeed TemplateURL know whether a TemplateURL is the default search |
110 // engine, callers instead must set this manually. | 113 // engine, callers instead must set this manually. |
111 bool append_extra_query_params; | 114 bool append_extra_query_params; |
112 | 115 |
113 // The raw content of an image thumbnail that will be used as a query for | 116 // The raw content of an image thumbnail that will be used as a query for |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 friend class TemplateURL; | 227 friend class TemplateURL; |
225 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); | 228 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); |
226 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterKnown); | 229 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterKnown); |
227 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterUnknown); | 230 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterUnknown); |
228 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLEmpty); | 231 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLEmpty); |
229 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoTemplateEnd); | 232 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoTemplateEnd); |
230 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters); | 233 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters); |
231 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters); | 234 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters); |
232 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter); | 235 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter); |
233 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, URLRefTestImageURLWithPOST); | 236 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, URLRefTestImageURLWithPOST); |
237 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ReflectsBookmarkBarPinned); | |
234 | 238 |
235 // Enumeration of the known types. | 239 // Enumeration of the known types. |
236 enum ReplacementType { | 240 enum ReplacementType { |
237 ENCODING, | 241 ENCODING, |
238 GOOGLE_ASSISTED_QUERY_STATS, | 242 GOOGLE_ASSISTED_QUERY_STATS, |
239 GOOGLE_BASE_URL, | 243 GOOGLE_BASE_URL, |
240 GOOGLE_BASE_SUGGEST_URL, | 244 GOOGLE_BASE_SUGGEST_URL, |
245 GOOGLE_BOOKMARK_BAR_PINNED, | |
241 GOOGLE_CURSOR_POSITION, | 246 GOOGLE_CURSOR_POSITION, |
242 GOOGLE_IMAGE_ORIGINAL_HEIGHT, | 247 GOOGLE_IMAGE_ORIGINAL_HEIGHT, |
243 GOOGLE_IMAGE_ORIGINAL_WIDTH, | 248 GOOGLE_IMAGE_ORIGINAL_WIDTH, |
244 GOOGLE_IMAGE_SEARCH_SOURCE, | 249 GOOGLE_IMAGE_SEARCH_SOURCE, |
245 GOOGLE_IMAGE_THUMBNAIL, | 250 GOOGLE_IMAGE_THUMBNAIL, |
246 GOOGLE_IMAGE_URL, | 251 GOOGLE_IMAGE_URL, |
247 GOOGLE_INSTANT_ENABLED, | 252 GOOGLE_INSTANT_ENABLED, |
248 GOOGLE_INSTANT_EXTENDED_ENABLED, | 253 GOOGLE_INSTANT_EXTENDED_ENABLED, |
249 GOOGLE_NTP_IS_THEMED, | 254 GOOGLE_NTP_IS_THEMED, |
250 GOOGLE_OMNIBOX_START_MARGIN, | 255 GOOGLE_OMNIBOX_START_MARGIN, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 mutable std::string host_; | 382 mutable std::string host_; |
378 mutable std::string path_; | 383 mutable std::string path_; |
379 mutable std::string search_term_key_; | 384 mutable std::string search_term_key_; |
380 mutable url_parse::Parsed::ComponentType search_term_key_location_; | 385 mutable url_parse::Parsed::ComponentType search_term_key_location_; |
381 | 386 |
382 mutable PostParams post_params_; | 387 mutable PostParams post_params_; |
383 | 388 |
384 // Whether the contained URL is a pre-populated URL. | 389 // Whether the contained URL is a pre-populated URL. |
385 bool prepopulated_; | 390 bool prepopulated_; |
386 | 391 |
392 // Whether search terms are shown in the omnibox on search results pages. | |
Peter Kasting
2013/10/01 21:54:55
Nit: Maybe add "This is kept as a member so it can
Jered
2013/10/01 23:07:07
Done.
| |
393 bool showing_search_terms_; | |
394 | |
387 DISALLOW_COPY_AND_ASSIGN(TemplateURLRef); | 395 DISALLOW_COPY_AND_ASSIGN(TemplateURLRef); |
388 }; | 396 }; |
389 | 397 |
390 | 398 |
391 // TemplateURLData ------------------------------------------------------------ | 399 // TemplateURLData ------------------------------------------------------------ |
392 | 400 |
393 // The data for the TemplateURL. Separating this into its own class allows most | 401 // The data for the TemplateURL. Separating this into its own class allows most |
394 // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with | 402 // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with |
395 // whatever fields are desired, then create an immutable TemplateURL from it. | 403 // whatever fields are desired, then create an immutable TemplateURL from it. |
396 struct TemplateURLData { | 404 struct TemplateURLData { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 // query. | 681 // query. |
674 void EncodeSearchTerms( | 682 void EncodeSearchTerms( |
675 const TemplateURLRef::SearchTermsArgs& search_terms_args, | 683 const TemplateURLRef::SearchTermsArgs& search_terms_args, |
676 bool is_in_query, | 684 bool is_in_query, |
677 std::string* input_encoding, | 685 std::string* input_encoding, |
678 string16* encoded_terms, | 686 string16* encoded_terms, |
679 string16* encoded_original_query) const; | 687 string16* encoded_original_query) const; |
680 | 688 |
681 private: | 689 private: |
682 friend class TemplateURLService; | 690 friend class TemplateURLService; |
691 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ReflectsBookmarkBarPinned); | |
683 | 692 |
684 void CopyFrom(const TemplateURL& other); | 693 void CopyFrom(const TemplateURL& other); |
685 | 694 |
686 void SetURL(const std::string& url); | 695 void SetURL(const std::string& url); |
687 void SetPrepopulateId(int id); | 696 void SetPrepopulateId(int id); |
688 | 697 |
689 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. | 698 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. |
690 // The |force| parameter is useful when the existing keyword is known to be | 699 // The |force| parameter is useful when the existing keyword is known to be |
691 // a placeholder. The resulting keyword is generated using | 700 // a placeholder. The resulting keyword is generated using |
692 // TemplateURLService::GenerateSearchURL() and | 701 // TemplateURLService::GenerateSearchURL() and |
(...skipping 18 matching lines...) Expand all Loading... | |
711 TemplateURLRef instant_url_ref_; | 720 TemplateURLRef instant_url_ref_; |
712 TemplateURLRef image_url_ref_; | 721 TemplateURLRef image_url_ref_; |
713 TemplateURLRef new_tab_url_ref_; | 722 TemplateURLRef new_tab_url_ref_; |
714 | 723 |
715 // TODO(sky): Add date last parsed OSD file. | 724 // TODO(sky): Add date last parsed OSD file. |
716 | 725 |
717 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 726 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
718 }; | 727 }; |
719 | 728 |
720 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 729 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
OLD | NEW |