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

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: Remove useless method 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
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..721137f453ba814eb7712368218e2b1e6f126222 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
@@ -178,6 +178,30 @@ public class TemplateUrlService {
mLoadListeners.removeObserver(listener);
}
+ /**
+ * Finds the default search engine for the default provider and returns the url query
+ * {@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 String getUrlForSearchQuery(String query) {
+ return nativeGetUrlForSearchQuery(mNativeTemplateUrlServiceAndroid, 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 String replaceSearchTermsInUrl(String query, String url) {
+ return nativeReplaceSearchTermsInUrl(mNativeTemplateUrlServiceAndroid, query, url);
+ }
+
private native int nativeInit();
private native void nativeLoad(int nativeTemplateUrlServiceAndroid);
private native boolean nativeIsLoaded(int nativeTemplateUrlServiceAndroid);
@@ -190,4 +214,8 @@ public class TemplateUrlService {
private native boolean nativeIsSearchProviderManaged(int nativeTemplateUrlServiceAndroid);
private native boolean nativeIsSearchByImageAvailable(int nativeTemplateUrlServiceAndroid);
private native boolean nativeIsDefaultSearchEngineGoogle(int nativeTemplateUrlServiceAndroid);
+ private native String nativeGetUrlForSearchQuery(int nativeTemplateUrlServiceAndroid,
+ String query);
+ private native String nativeReplaceSearchTermsInUrl(int nativeTemplateUrlServiceAndroid,
+ String query, String currentUrl);
}
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698