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

Unified Diff: ios/chrome/browser/search/search_util.h

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.cc ('k') | ios/chrome/browser/search/search_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/search/search_util.h
diff --git a/ios/chrome/browser/search/search_util.h b/ios/chrome/browser/search/search_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cb0b009163dd0942e92a567c28cce9c78faae7c
--- /dev/null
+++ b/ios/chrome/browser/search/search_util.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_SEARCH_SEARCH_UTIL_H_
+#define IOS_CHROME_BROWSER_SEARCH_SEARCH_UTIL_H_
+
+#include "base/strings/string16.h"
+
+class GURL;
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+namespace web {
+class WebState;
+}
+
+// Extracts and returns search terms from |url|. Does not consider
+// IsQueryExtractionEnabled() and Instant support state of the page and does
+// not check for a privileged process, so most callers should use
+// GetSearchTerms() below instead.
+base::string16 ExtractSearchTermsFromURL(ios::ChromeBrowserState* browser_state,
+ const GURL& url);
+
+// Returns true if it is okay to extract search terms from |url|. |url| must
+// have a secure scheme and must contain the search terms replacement key for
+// the default search provider.
+bool IsQueryExtractionAllowedForURL(ios::ChromeBrowserState* browser_state,
+ const GURL& url);
+
+// Returns search terms if this WebState is a search results page. It looks
+// in the visible NavigationItem first, to see if search terms have already
+// been extracted. Failing that, it tries to extract search terms from the URL.
+//
+// Returns a blank string if search terms were not found, or if search terms
+// extraction is disabled for this WebState or BrowserState, or if |web_state|
+// does not support Instant.
+base::string16 GetSearchTerms(web::WebState* web_state);
+
+#endif // IOS_CHROME_BROWSER_SEARCH_SEARCH_UTIL_H_
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.cc ('k') | ios/chrome/browser/search/search_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698