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