| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Returns the Local Instant URL of the New Tab Page. | 140 // Returns the Local Instant URL of the New Tab Page. |
| 141 // TODO(kmadhusu): Remove this function and update the call sites. | 141 // TODO(kmadhusu): Remove this function and update the call sites. |
| 142 GURL GetLocalInstantURL(Profile* profile); | 142 GURL GetLocalInstantURL(Profile* profile); |
| 143 | 143 |
| 144 // Returns true if 'hide_verbatim' flag is enabled in field trials | 144 // Returns true if 'hide_verbatim' flag is enabled in field trials |
| 145 // to hide the top match in the native suggestions dropdown if it is a verbatim | 145 // to hide the top match in the native suggestions dropdown if it is a verbatim |
| 146 // match. See comments on ShouldHideTopMatch in autocomplete_result.h. | 146 // match. See comments on ShouldHideTopMatch in autocomplete_result.h. |
| 147 bool ShouldHideTopVerbatimMatch(); | 147 bool ShouldHideTopVerbatimMatch(); |
| 148 | 148 |
| 149 // Returns true if the cacheable NTP should be shown and false if not. | |
| 150 // Exposed for testing. | |
| 151 bool ShouldUseCacheableNTP(); | |
| 152 | |
| 153 // Returns true if the Instant NTP should be shown and false if not. | |
| 154 bool ShouldShowInstantNTP(); | |
| 155 | |
| 156 // Returns when we should show a search button in the omnibox. This may be any | 149 // Returns when we should show a search button in the omnibox. This may be any |
| 157 // of several values, some of which depend on whether the underlying state of | 150 // of several values, some of which depend on whether the underlying state of |
| 158 // the page would normally be to perform search term replacement; see also | 151 // the page would normally be to perform search term replacement; see also |
| 159 // ToolbarModel::WouldPerformSearchTermReplacement(). | 152 // ToolbarModel::WouldPerformSearchTermReplacement(). |
| 160 DisplaySearchButtonConditions GetDisplaySearchButtonConditions(); | 153 DisplaySearchButtonConditions GetDisplaySearchButtonConditions(); |
| 161 | 154 |
| 162 // Returns true if the origin chip should be shown next to the omnibox. This | 155 // Returns true if the origin chip should be shown next to the omnibox. This |
| 163 // also includes the related changes to the omnibox. | 156 // also includes the related changes to the omnibox. |
| 164 bool ShouldDisplayOriginChip(); | 157 bool ShouldDisplayOriginChip(); |
| 165 | 158 |
| 166 // Transforms the input |url| into its "effective URL". The returned URL | 159 // Transforms the input |url| into its "effective URL". The returned URL |
| 167 // facilitates grouping process-per-site. The |url| is transformed, for | 160 // facilitates grouping process-per-site. The |url| is transformed, for |
| 168 // example, from | 161 // example, from |
| 169 // | 162 // |
| 170 // https://www.google.com/search?espv=1&q=tractors | 163 // https://www.google.com/search?espv=1&q=tractors |
| 171 // | 164 // |
| 172 // to the privileged URL | 165 // to the privileged URL |
| 173 // | 166 // |
| 174 // chrome-search://www.google.com/search?espv=1&q=tractors | 167 // chrome-search://www.google.com/search?espv=1&q=tractors |
| 175 // | 168 // |
| 176 // Notice the scheme change. | 169 // Notice the scheme change. |
| 177 // | 170 // |
| 178 // If the input is already a privileged URL then that same URL is returned. | 171 // If the input is already a privileged URL then that same URL is returned. |
| 179 // | 172 // |
| 180 // If |url| is that of the online NTP, its host is replaced with "online-ntp". | 173 // If |url| is that of the online NTP, its host is replaced with "online-ntp". |
| 181 // This forces the NTP and search results pages to have different SiteIntances, | 174 // This forces the NTP and search results pages to have different SiteIntances, |
| 182 // and hence different processes. | 175 // and hence different processes. |
| 183 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile); | 176 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile); |
| 184 | 177 |
| 185 // Returns the staleness timeout (in seconds) that should be used to refresh the | |
| 186 // InstantLoader. | |
| 187 int GetInstantLoaderStalenessTimeoutSec(); | |
| 188 | |
| 189 // Returns true if |contents| corresponds to a preloaded instant extended NTP. | |
| 190 bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents); | |
| 191 | |
| 192 // Rewrites |url| if | 178 // Rewrites |url| if |
| 193 // 1. |url| is kChromeUINewTabURL, | 179 // 1. |url| is kChromeUINewTabURL, |
| 194 // 2. InstantExtended is enabled, and | 180 // 2. InstantExtended is enabled, and |
| 195 // 3. The --instant-new-tab-url switch is set to a valid URL. | 181 // 3. The --instant-new-tab-url switch is set to a valid URL. |
| 196 // |url| is rewritten to the value of --instant-new-tab-url. | 182 // |url| is rewritten to the value of --instant-new-tab-url. |
| 197 bool HandleNewTabURLRewrite(GURL* url, | 183 bool HandleNewTabURLRewrite(GURL* url, |
| 198 content::BrowserContext* browser_context); | 184 content::BrowserContext* browser_context); |
| 199 // Reverses the operation from HandleNewTabURLRewrite. | 185 // Reverses the operation from HandleNewTabURLRewrite. |
| 200 bool HandleNewTabURLReverseRewrite(GURL* url, | 186 bool HandleNewTabURLReverseRewrite(GURL* url, |
| 201 content::BrowserContext* browser_context); | 187 content::BrowserContext* browser_context); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 236 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 251 bool default_value, | 237 bool default_value, |
| 252 const FieldTrialFlags& flags); | 238 const FieldTrialFlags& flags); |
| 253 | 239 |
| 254 // Returns the Cacheable New Tab Page URL for the given |profile|. | 240 // Returns the Cacheable New Tab Page URL for the given |profile|. |
| 255 GURL GetNewTabPageURL(Profile* profile); | 241 GURL GetNewTabPageURL(Profile* profile); |
| 256 | 242 |
| 257 } // namespace chrome | 243 } // namespace chrome |
| 258 | 244 |
| 259 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ | 245 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ |
| OLD | NEW |