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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java

Issue 1070443003: Always add flag "FLAG_ACTIVITY_NEW_TASK" when doing a Web Search (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: AwContentViewClient Created 5 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
index 2246be3001505b040513befab9e83a2967bc78a5..168ea650dc363f9fb2864854ff82336e1d4c93a3 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
@@ -5,6 +5,7 @@
package org.chromium.android_webview;
import android.annotation.SuppressLint;
+import android.app.SearchManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -189,4 +190,23 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
public boolean isExternalFlingActive() {
return mAwContents.isFlingActive();
}
+
+ @Override
+ public boolean doesPerformWebSearch() {
+ return true;
+ }
+
+ @Override
+ public void performWebSearch(String query) {
+ Intent i = new Intent(Intent.ACTION_WEB_SEARCH);
+ i.putExtra(SearchManager.EXTRA_NEW_SEARCH, true);
+ i.putExtra(SearchManager.QUERY, query);
+ i.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName());
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ mContext.startActivity(i);
+ } catch (android.content.ActivityNotFoundException ex) {
+ // If no app handles it, do nothing.
+ }
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698