| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_SEARCH_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_SEARCH_H_ |
| 6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ | 6 #define CHROME_BROWSER_SEARCH_SEARCH_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // if the engine doesn't have an Instant URL, or if it shouldn't be used (say | 106 // if the engine doesn't have an Instant URL, or if it shouldn't be used (say |
| 107 // because it doesn't satisfy the requirements for extended mode or if Instant | 107 // because it doesn't satisfy the requirements for extended mode or if Instant |
| 108 // is disabled through preferences). Callers must check that the returned URL is | 108 // is disabled through preferences). Callers must check that the returned URL is |
| 109 // valid before using it. The value of |start_margin| is used for the "es_sm" | 109 // valid before using it. The value of |start_margin| is used for the "es_sm" |
| 110 // parameter in the URL. | 110 // parameter in the URL. |
| 111 // NOTE: This method expands the default search engine's instant_url template, | 111 // NOTE: This method expands the default search engine's instant_url template, |
| 112 // so it shouldn't be called from SearchTermsData or other such code that would | 112 // so it shouldn't be called from SearchTermsData or other such code that would |
| 113 // lead to an infinite recursion. | 113 // lead to an infinite recursion. |
| 114 GURL GetInstantURL(Profile* profile, int start_margin); | 114 GURL GetInstantURL(Profile* profile, int start_margin); |
| 115 | 115 |
| 116 // Returns URLs associated with the default search engine for |profile|. |
| 117 std::vector<GURL> GetSearchURLs(Profile* profile); |
| 118 |
| 116 // Returns the Local Instant URL of the New Tab Page. | 119 // Returns the Local Instant URL of the New Tab Page. |
| 117 // TODO(kmadhusu): Remove this function and update the call sites. | 120 // TODO(kmadhusu): Remove this function and update the call sites. |
| 118 GURL GetLocalInstantURL(Profile* profile); | 121 GURL GetLocalInstantURL(Profile* profile); |
| 119 | 122 |
| 120 // Returns true if 'hide_verbatim' flag is enabled in field trials | 123 // Returns true if 'hide_verbatim' flag is enabled in field trials |
| 121 // to hide the top match in the native suggestions dropdown if it is a verbatim | 124 // to hide the top match in the native suggestions dropdown if it is a verbatim |
| 122 // match. See comments on ShouldHideTopMatch in autocomplete_result.h. | 125 // match. See comments on ShouldHideTopMatch in autocomplete_result.h. |
| 123 bool ShouldHideTopVerbatimMatch(); | 126 bool ShouldHideTopVerbatimMatch(); |
| 124 | 127 |
| 125 // Returns true if 'use_remote_ntp_on_startup' flag is enabled in field trials | 128 // Returns true if 'use_remote_ntp_on_startup' flag is enabled in field trials |
| 126 // to always show the remote NTP on browser startup. | 129 // to always show the remote NTP on browser startup. |
| 127 bool ShouldPreferRemoteNTPOnStartup(); | 130 bool ShouldPreferRemoteNTPOnStartup(); |
| 128 | 131 |
| 129 // Returns true if the cacheable NTP should be shown and false if not. | 132 // Returns true if the cacheable NTP should be shown and false if not. |
| 130 // Exposed for testing. | 133 // Exposed for testing. |
| 131 bool ShouldUseCacheableNTP(); | 134 bool ShouldUseCacheableNTP(); |
| 132 | 135 |
| 133 // Returns true if the Instant NTP should be shown and false if not. | 136 // Returns true if the Instant NTP should be shown and false if not. |
| 134 bool ShouldShowInstantNTP(); | 137 bool ShouldShowInstantNTP(); |
| 135 | 138 |
| 136 // Returns true if the recent tabs link should be shown on the local NTP in | 139 // Returns true if the recent tabs link should be shown on the local NTP in |
| 137 // field trials. | 140 // field trials. |
| 138 bool ShouldShowRecentTabsOnNTP(); | 141 bool ShouldShowRecentTabsOnNTP(); |
| 139 | 142 |
| 140 // Returns true if Instant Extended should be disabled on the search results | 143 // Returns true if Instant Extended should be disabled on the search results |
| 141 // page. | 144 // page. |
| 142 bool ShouldSuppressInstantExtendedOnSRP(); | 145 bool ShouldSuppressInstantExtendedOnSRP(); |
| 143 | 146 |
| 144 // Returns true if |my_url| matches |other_url|. | |
| 145 bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url); | |
| 146 | |
| 147 // Transforms the input |url| into its "effective URL". The returned URL | 147 // Transforms the input |url| into its "effective URL". The returned URL |
| 148 // facilitates grouping process-per-site. The |url| is transformed, for | 148 // facilitates grouping process-per-site. The |url| is transformed, for |
| 149 // example, from | 149 // example, from |
| 150 // | 150 // |
| 151 // https://www.google.com/search?espv=1&q=tractors | 151 // https://www.google.com/search?espv=1&q=tractors |
| 152 // | 152 // |
| 153 // to the privileged URL | 153 // to the privileged URL |
| 154 // | 154 // |
| 155 // chrome-search://www.google.com/search?espv=1&q=tractors | 155 // chrome-search://www.google.com/search?espv=1&q=tractors |
| 156 // | 156 // |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 uint64 default_value, | 232 uint64 default_value, |
| 233 const FieldTrialFlags& flags); | 233 const FieldTrialFlags& flags); |
| 234 | 234 |
| 235 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 235 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 236 // Exposed for testing only. | 236 // Exposed for testing only. |
| 237 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 237 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 238 bool default_value, | 238 bool default_value, |
| 239 const FieldTrialFlags& flags); | 239 const FieldTrialFlags& flags); |
| 240 | 240 |
| 241 // Returns the Cacheable New Tab Page URL for the given |profile|. | 241 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 242 // Exposed for testing only. | |
| 243 GURL GetNewTabPageURL(Profile* profile); | 242 GURL GetNewTabPageURL(Profile* profile); |
| 244 | 243 |
| 245 // Let tests reset the gate that prevents metrics from being sent more than | 244 // Let tests reset the gate that prevents metrics from being sent more than |
| 246 // once. | 245 // once. |
| 247 void ResetInstantExtendedOptInStateGateForTest(); | 246 void ResetInstantExtendedOptInStateGateForTest(); |
| 248 | 247 |
| 249 } // namespace chrome | 248 } // namespace chrome |
| 250 | 249 |
| 251 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 250 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |