Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: chrome/browser/search/search.h

Issue 141893009: Create a new helper function to extract search terms from the URL irrespective of the availablility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 bool IsInstantExtendedAPIEnabled(); 71 bool IsInstantExtendedAPIEnabled();
72 72
73 // Returns whether the suggest is enabled for the given |profile|. 73 // Returns whether the suggest is enabled for the given |profile|.
74 bool IsSuggestPrefEnabled(Profile* profile); 74 bool IsSuggestPrefEnabled(Profile* profile);
75 75
76 // Returns the value to pass to the &espv CGI parameter when loading the 76 // Returns the value to pass to the &espv CGI parameter when loading the
77 // embedded search page from the user's default search provider. Returns 0 if 77 // embedded search page from the user's default search provider. Returns 0 if
78 // the Instant Extended API is not enabled. 78 // the Instant Extended API is not enabled.
79 uint64 EmbeddedSearchPageVersion(); 79 uint64 EmbeddedSearchPageVersion();
80 80
81 // Returns whether query extraction is enabled. 81 // Returns whether query extraction flag is enabled in the field trials.
samarth 2014/02/12 18:02:39 Any reason for changing this comment? I prefer the
kmadhusu 2014/02/12 19:58:09 I just want to distinguish IsQueryExtractionEnable
82 bool IsQueryExtractionEnabled(); 82 bool IsQueryExtractionEnabled();
83 83
84 // Extracts and returns search terms from |url|. Returns empty string if the URL 84 // Extracts and returns search terms from |url|. Does not consider
85 // is not secure or doesn't have a search term replacement key. Does not 85 // IsQueryExtractionEnabled() and Instant support state of the page and does
86 // consider IsQueryExtractionEnabled() and Instant support state of the page and 86 // not check for a privileged process, so most callers should use
87 // does not check for a privileged process, so most callers should use
88 // GetSearchTerms() below instead. 87 // GetSearchTerms() below instead.
89 base::string16 GetSearchTermsFromURL(Profile* profile, const GURL& url); 88 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url);
89
90 // Returns true if it is okay to extract search terms from |url|. |url| must
91 // have a secure scheme and must contain the search terms replacement key for
92 // the default search provider.
93 bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url);
90 94
91 // Returns the search terms attached to a specific NavigationEntry, or empty 95 // Returns the search terms attached to a specific NavigationEntry, or empty
92 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not 96 // string otherwise. Does not consider IsQueryExtractionEnabled() and does not
93 // check Instant support, so most callers should use GetSearchTerms() below 97 // check Instant support, so most callers should use GetSearchTerms() below
94 // instead. 98 // instead.
95 base::string16 GetSearchTermsFromNavigationEntry( 99 base::string16 GetSearchTermsFromNavigationEntry(
96 const content::NavigationEntry* entry); 100 const content::NavigationEntry* entry);
97 101
98 // Returns search terms if this WebContents is a search results page. It looks 102 // Returns search terms if this WebContents is a search results page. It looks
99 // in the visible NavigationEntry first, to see if search terms have already 103 // in the visible NavigationEntry first, to see if search terms have already
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 bool GetBoolValueForFlagWithDefault(const std::string& flag, 278 bool GetBoolValueForFlagWithDefault(const std::string& flag,
275 bool default_value, 279 bool default_value,
276 const FieldTrialFlags& flags); 280 const FieldTrialFlags& flags);
277 281
278 // Returns the Cacheable New Tab Page URL for the given |profile|. 282 // Returns the Cacheable New Tab Page URL for the given |profile|.
279 GURL GetNewTabPageURL(Profile* profile); 283 GURL GetNewTabPageURL(Profile* profile);
280 284
281 } // namespace chrome 285 } // namespace chrome
282 286
283 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ 287 #endif // CHROME_BROWSER_SEARCH_SEARCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698