| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // For more details, see http://goto.google.com/binary-clients-logging . | 140 // For more details, see http://goto.google.com/binary-clients-logging . |
| 141 std::string assisted_query_stats; | 141 std::string assisted_query_stats; |
| 142 | 142 |
| 143 // TODO: Remove along with "aq" CGI param. | 143 // TODO: Remove along with "aq" CGI param. |
| 144 int accepted_suggestion; | 144 int accepted_suggestion; |
| 145 | 145 |
| 146 // The 0-based position of the cursor within the query string at the time | 146 // The 0-based position of the cursor within the query string at the time |
| 147 // the request was issued. Set to base::string16::npos if not used. | 147 // the request was issued. Set to base::string16::npos if not used. |
| 148 size_t cursor_position; | 148 size_t cursor_position; |
| 149 | 149 |
| 150 // True to enable the start-edge margin of the omnibox, used in extended | |
| 151 // Instant to align the preview contents with the omnibox. | |
| 152 bool enable_omnibox_start_margin; | |
| 153 | |
| 154 // The URL of the current webpage to be used for experimental zero-prefix | 150 // The URL of the current webpage to be used for experimental zero-prefix |
| 155 // suggestions. | 151 // suggestions. |
| 156 std::string current_page_url; | 152 std::string current_page_url; |
| 157 | 153 |
| 158 // Which omnibox the user used to type the prefix. | 154 // Which omnibox the user used to type the prefix. |
| 159 metrics::OmniboxEventProto::PageClassification page_classification; | 155 metrics::OmniboxEventProto::PageClassification page_classification; |
| 160 | 156 |
| 161 // True for searches issued with the bookmark bar pref set to shown. | |
| 162 bool bookmark_bar_pinned; | |
| 163 | |
| 164 // Optional session token. | 157 // Optional session token. |
| 165 std::string session_token; | 158 std::string session_token; |
| 166 | 159 |
| 167 // Prefetch query and type. | 160 // Prefetch query and type. |
| 168 std::string prefetch_query; | 161 std::string prefetch_query; |
| 169 std::string prefetch_query_type; | 162 std::string prefetch_query_type; |
| 170 | 163 |
| 171 // Additional query params provided by the suggest server. | 164 // Additional query params provided by the suggest server. |
| 172 std::string suggest_query_params; | 165 std::string suggest_query_params; |
| 173 | 166 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 friend class TemplateURLTest; | 297 friend class TemplateURLTest; |
| 305 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); | 298 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, SetPrepopulatedAndParse); |
| 306 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterKnown); | 299 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterKnown); |
| 307 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterUnknown); | 300 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseParameterUnknown); |
| 308 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLEmpty); | 301 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLEmpty); |
| 309 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoTemplateEnd); | 302 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoTemplateEnd); |
| 310 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters); | 303 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters); |
| 311 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters); | 304 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters); |
| 312 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter); | 305 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter); |
| 313 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, URLRefTestImageURLWithPOST); | 306 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, URLRefTestImageURLWithPOST); |
| 314 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ReflectsBookmarkBarPinned); | |
| 315 | 307 |
| 316 // Enumeration of the known types. | 308 // Enumeration of the known types. |
| 317 enum ReplacementType { | 309 enum ReplacementType { |
| 318 ENCODING, | 310 ENCODING, |
| 319 GOOGLE_ASSISTED_QUERY_STATS, | 311 GOOGLE_ASSISTED_QUERY_STATS, |
| 320 GOOGLE_BASE_URL, | 312 GOOGLE_BASE_URL, |
| 321 GOOGLE_BASE_SUGGEST_URL, | 313 GOOGLE_BASE_SUGGEST_URL, |
| 322 GOOGLE_BOOKMARK_BAR_PINNED, | |
| 323 GOOGLE_CURRENT_PAGE_URL, | 314 GOOGLE_CURRENT_PAGE_URL, |
| 324 GOOGLE_CURSOR_POSITION, | 315 GOOGLE_CURSOR_POSITION, |
| 325 GOOGLE_FORCE_INSTANT_RESULTS, | 316 GOOGLE_FORCE_INSTANT_RESULTS, |
| 326 GOOGLE_IMAGE_ORIGINAL_HEIGHT, | 317 GOOGLE_IMAGE_ORIGINAL_HEIGHT, |
| 327 GOOGLE_IMAGE_ORIGINAL_WIDTH, | 318 GOOGLE_IMAGE_ORIGINAL_WIDTH, |
| 328 GOOGLE_IMAGE_SEARCH_SOURCE, | 319 GOOGLE_IMAGE_SEARCH_SOURCE, |
| 329 GOOGLE_IMAGE_THUMBNAIL, | 320 GOOGLE_IMAGE_THUMBNAIL, |
| 330 GOOGLE_IMAGE_URL, | 321 GOOGLE_IMAGE_URL, |
| 331 GOOGLE_INPUT_TYPE, | 322 GOOGLE_INPUT_TYPE, |
| 332 GOOGLE_INSTANT_EXTENDED_ENABLED, | 323 GOOGLE_INSTANT_EXTENDED_ENABLED, |
| 333 GOOGLE_NTP_IS_THEMED, | 324 GOOGLE_NTP_IS_THEMED, |
| 334 GOOGLE_OMNIBOX_START_MARGIN, | |
| 335 GOOGLE_CONTEXTUAL_SEARCH_VERSION, | 325 GOOGLE_CONTEXTUAL_SEARCH_VERSION, |
| 336 GOOGLE_CONTEXTUAL_SEARCH_CONTEXT_DATA, | 326 GOOGLE_CONTEXTUAL_SEARCH_CONTEXT_DATA, |
| 337 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, | 327 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, |
| 338 GOOGLE_PAGE_CLASSIFICATION, | 328 GOOGLE_PAGE_CLASSIFICATION, |
| 339 GOOGLE_PREFETCH_QUERY, | 329 GOOGLE_PREFETCH_QUERY, |
| 340 GOOGLE_RLZ, | 330 GOOGLE_RLZ, |
| 341 GOOGLE_SEARCH_CLIENT, | 331 GOOGLE_SEARCH_CLIENT, |
| 342 GOOGLE_SEARCH_FIELDTRIAL_GROUP, | 332 GOOGLE_SEARCH_FIELDTRIAL_GROUP, |
| 343 GOOGLE_SEARCH_VERSION, | 333 GOOGLE_SEARCH_VERSION, |
| 344 GOOGLE_SESSION_TOKEN, | 334 GOOGLE_SESSION_TOKEN, |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 std::string* input_encoding, | 697 std::string* input_encoding, |
| 708 base::string16* encoded_terms, | 698 base::string16* encoded_terms, |
| 709 base::string16* encoded_original_query) const; | 699 base::string16* encoded_original_query) const; |
| 710 | 700 |
| 711 // Returns the search url for this template URL. | 701 // Returns the search url for this template URL. |
| 712 // Returns an empty GURL if this template URL has no url(). | 702 // Returns an empty GURL if this template URL has no url(). |
| 713 GURL GenerateSearchURL(const SearchTermsData& search_terms_data) const; | 703 GURL GenerateSearchURL(const SearchTermsData& search_terms_data) const; |
| 714 | 704 |
| 715 private: | 705 private: |
| 716 friend class TemplateURLService; | 706 friend class TemplateURLService; |
| 717 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ReflectsBookmarkBarPinned); | |
| 718 | 707 |
| 719 void CopyFrom(const TemplateURL& other); | 708 void CopyFrom(const TemplateURL& other); |
| 720 | 709 |
| 721 void SetURL(const std::string& url); | 710 void SetURL(const std::string& url); |
| 722 void SetPrepopulateId(int id); | 711 void SetPrepopulateId(int id); |
| 723 | 712 |
| 724 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. | 713 // Resets the keyword if IsGoogleSearchURLWithReplaceableKeyword() or |force|. |
| 725 // The |force| parameter is useful when the existing keyword is known to be | 714 // The |force| parameter is useful when the existing keyword is known to be |
| 726 // a placeholder. The resulting keyword is generated using | 715 // a placeholder. The resulting keyword is generated using |
| 727 // GenerateSearchURL() and GenerateKeyword(). | 716 // GenerateSearchURL() and GenerateKeyword(). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 746 TemplateURLRef new_tab_url_ref_; | 735 TemplateURLRef new_tab_url_ref_; |
| 747 TemplateURLRef contextual_search_url_ref_; | 736 TemplateURLRef contextual_search_url_ref_; |
| 748 scoped_ptr<AssociatedExtensionInfo> extension_info_; | 737 scoped_ptr<AssociatedExtensionInfo> extension_info_; |
| 749 | 738 |
| 750 // TODO(sky): Add date last parsed OSD file. | 739 // TODO(sky): Add date last parsed OSD file. |
| 751 | 740 |
| 752 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 741 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 753 }; | 742 }; |
| 754 | 743 |
| 755 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ | 744 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |