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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java

Issue 23654021: Expose the ability to perform a search from CVC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved intent kickoff back to callback Created 7 years, 3 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
Index: chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
index 4ea0c30ed980dfe2505a27b15c18f84bf9f2d3f6..b841f7904d4cf2249db61586bfe4e189208a5abb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/search_engines/TemplateUrlService.java
@@ -68,6 +68,30 @@ public class TemplateUrlService {
return sService;
}
+ /**
+ * Finds the default search engine for the current profile and returns the url query
Yaron 2013/09/10 16:31:46 Maybe s/current profile/default provider/ ?
David Trainor- moved to gerrit 2013/09/10 22:35:46 Done.
+ * {@link String} for {@code query}.
+ * @param query The {@link String} that represents the text query the search url should
+ * represent.
+ * @return A {@link String} that contains the url of the default search engine with
+ * {@code query} inserted as the search parameter.
+ */
+ public static String getUrlForSearchQuery(String query) {
+ return nativeGetUrlForSearchQuery(query);
+ }
+
+ /**
+ * Replaces the search terms from {@code query} in {@code url}.
+ * @param query The {@link String} that represents the text query that should replace the
+ * existing query in {@code url}.
+ * @param url The {@link String} that contains the search url with another search query that
+ * will be replaced with {@code query}.
+ * @return A new version of {@code url} with the search term replaced with {@code query}.
+ */
+ public static String replaceSearchTermsInUrl(String query, String url) {
+ return nativeReplaceSearchTermsInUrl(query, url);
+ }
+
private final int mNativeTemplateUrlServiceAndroid;
private final ObserverList<LoadListener> mLoadListeners = new ObserverList<LoadListener>();
@@ -190,4 +214,7 @@ public class TemplateUrlService {
private native boolean nativeIsSearchProviderManaged(int nativeTemplateUrlServiceAndroid);
private native boolean nativeIsSearchByImageAvailable(int nativeTemplateUrlServiceAndroid);
private native boolean nativeIsDefaultSearchEngineGoogle(int nativeTemplateUrlServiceAndroid);
+
+ private static native String nativeGetUrlForSearchQuery(String query);
+ private static native String nativeReplaceSearchTermsInUrl(String query, String currentUrl);
}

Powered by Google App Engine
This is Rietveld 408576698