diff options
author | Bjorn Bringert <bringert@android.com> | 2009-09-22 10:36:01 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2009-09-22 20:44:31 +0100 |
commit | 0485170e03e079eb61b9dd52fc2c98da02fa7b2c (patch) | |
tree | 10549bf5e066b760cdc20bff677e0a1cea17fef1 /src/com/android | |
parent | e08dbd1e3f486153b9765dc51bb13a8231bec57b (diff) | |
download | packages_apps_Browser-0485170e03e079eb61b9dd52fc2c98da02fa7b2c.zip packages_apps_Browser-0485170e03e079eb61b9dd52fc2c98da02fa7b2c.tar.gz packages_apps_Browser-0485170e03e079eb61b9dd52fc2c98da02fa7b2c.tar.bz2 |
Pass search intent extra data through the browser
This is needed by some web search providers for logging.
Change-Id: I7a6dba26d79ee97e4a4628269b212e80151ad9ee
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 8 | ||||
-rw-r--r-- | src/com/android/browser/BrowserProvider.java | 18 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 448d332..c4797ad 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -617,7 +617,8 @@ public class BrowserActivity extends Activity || Intent.ACTION_WEB_SEARCH.equals(action)) { url = intent.getStringExtra(SearchManager.QUERY); } - return handleWebSearchRequest(url, intent.getBundleExtra(SearchManager.APP_DATA)); + return handleWebSearchRequest(url, intent.getBundleExtra(SearchManager.APP_DATA), + intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); } /** @@ -625,7 +626,7 @@ public class BrowserActivity extends Activity * was identified as plain search terms and not URL/shortcut. * @return true if the request was handled and web search activity was launched, false if not. */ - private boolean handleWebSearchRequest(String inUrl, Bundle appData) { + private boolean handleWebSearchRequest(String inUrl, Bundle appData, String extraData) { if (inUrl == null) return false; // In general, we shouldn't modify URL from Intent. @@ -649,6 +650,9 @@ public class BrowserActivity extends Activity if (appData != null) { intent.putExtra(SearchManager.APP_DATA, appData); } + if (extraData != null) { + intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); + } intent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName()); startActivity(intent); diff --git a/src/com/android/browser/BrowserProvider.java b/src/com/android/browser/BrowserProvider.java index c90ad49..8e0929b 100644 --- a/src/com/android/browser/BrowserProvider.java +++ b/src/com/android/browser/BrowserProvider.java @@ -88,6 +88,7 @@ public class BrowserProvider extends ContentProvider { private static final int SUGGEST_COLUMN_ICON_2_ID = 6; private static final int SUGGEST_COLUMN_QUERY_ID = 7; private static final int SUGGEST_COLUMN_FORMAT = 8; + private static final int SUGGEST_COLUMN_INTENT_EXTRA_DATA = 9; // shared suggestion columns private static final String[] COLUMNS = new String[] { @@ -99,7 +100,8 @@ public class BrowserProvider extends ContentProvider { SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_ICON_2, SearchManager.SUGGEST_COLUMN_QUERY, - SearchManager.SUGGEST_COLUMN_FORMAT}; + SearchManager.SUGGEST_COLUMN_FORMAT, + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA}; private static final int MAX_SUGGESTION_SHORT_ENTRIES = 3; private static final int MAX_SUGGESTION_LONG_ENTRIES = 6; @@ -444,6 +446,7 @@ public class BrowserProvider extends ContentProvider { private int mSuggestText1Id; private int mSuggestText2Id; private int mSuggestQueryId; + private int mSuggestIntentExtraDataId; public MySuggestionCursor(Cursor hc, Cursor sc, String string) { mHistoryCursor = hc; @@ -463,6 +466,7 @@ public class BrowserProvider extends ContentProvider { mSuggestText1Id = -1; mSuggestText2Id = -1; mSuggestQueryId = -1; + mSuggestIntentExtraDataId = -1; } else { mSuggestText1Id = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_TEXT_1); @@ -470,6 +474,8 @@ public class BrowserProvider extends ContentProvider { SearchManager.SUGGEST_COLUMN_TEXT_2); mSuggestQueryId = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_QUERY); + mSuggestIntentExtraDataId = mSuggestCursor.getColumnIndex( + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA); } } @@ -578,6 +584,16 @@ public class BrowserProvider extends ContentProvider { case SUGGEST_COLUMN_FORMAT: return "html"; + + case SUGGEST_COLUMN_INTENT_EXTRA_DATA: + if (mHistoryCount > mPos) { + return null; + } else if (!mBeyondCursor) { + if (mSuggestIntentExtraDataId == -1) return null; + return mSuggestCursor.getString(mSuggestIntentExtraDataId); + } else { + return null; + } } } return null; |