summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike LeBeau <mlebeau@android.com>2009-07-28 15:02:09 -0700
committerMike LeBeau <mlebeau@android.com>2009-07-28 15:02:09 -0700
commit2a499b30add5e005eeebb5a008763d90f8b29395 (patch)
treeb0f0007db31f8c98eb8274df4dd97d030138aad4
parent9c19b7e37c5507caa209afe57e3ad2069f4b9c55 (diff)
downloadGoogleSearch-2a499b30add5e005eeebb5a008763d90f8b29395.tar.gz
Pass through the browser's application id extra if one is provided, so that the browser can figure out which window to put a new search into.
-rw-r--r--src/com/android/googlesearch/GoogleSearch.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/googlesearch/GoogleSearch.java b/src/com/android/googlesearch/GoogleSearch.java
index f7e2a6f..ea0652a 100644
--- a/src/com/android/googlesearch/GoogleSearch.java
+++ b/src/com/android/googlesearch/GoogleSearch.java
@@ -106,12 +106,20 @@ public class GoogleSearch extends Activity {
if (appSearchData != null) {
source = appSearchData.getString(SearchManager.SOURCE);
}
+
+ // The browser can pass along an application id which it uses to figure out which
+ // window to place a new search into. So if this exists, we'll pass it back to
+ // the browser.
+ String applicationId = intent.getStringExtra(Browser.EXTRA_APPLICATION_ID);
try {
String searchUri = googleSearchUrlBase
+ "&source=android-" + source
+ "&q=" + URLEncoder.encode(query, "UTF-8");
Intent launchUriIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri));
+ if (applicationId != null) {
+ launchUriIntent.putExtra(Browser.EXTRA_APPLICATION_ID, applicationId);
+ }
launchUriIntent.putExtra(Browser.EXTRA_POST_DATA, getLocationData());
launchUriIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(launchUriIntent);