summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2010-12-09 09:45:52 -0800
committerMichael Kolb <kolby@google.com>2010-12-09 09:45:56 -0800
commit257cc2c8fcdd7117317e89861d4509955a622be8 (patch)
tree6cf84c92121aab6a5f3dfdf67a19db0d537b5eb8 /src/com
parent14ee8fbf5a647152d9a106b054b206be68c11e03 (diff)
downloadpackages_apps_Browser-257cc2c8fcdd7117317e89861d4509955a622be8.zip
packages_apps_Browser-257cc2c8fcdd7117317e89861d4509955a622be8.tar.gz
packages_apps_Browser-257cc2c8fcdd7117317e89861d4509955a622be8.tar.bz2
add source type to search queries
Bug: http://b/issue?id=3237688 add the source extra to search queries based on the source Change-Id: Id39083a5904c7ff98431e7e625871f920f634bcf
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/TitleBarXLarge.java11
-rw-r--r--src/com/android/browser/UrlInputView.java18
2 files changed, 20 insertions, 9 deletions
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index de3c39f..42effe1 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
+import android.os.Bundle;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -131,7 +132,8 @@ public class TitleBarXLarge extends TitleBarBase
stopOrRefresh();
} else if (mGoButton == v) {
if (!TextUtils.isEmpty(mUrlFocused.getText())) {
- onAction(mUrlFocused.getText().toString(), null);
+ onAction(mUrlFocused.getText().toString(), null,
+ UrlInputView.TYPED);
}
} else if (mClearButton == v) {
mUrlFocused.setText("");
@@ -148,7 +150,7 @@ public class TitleBarXLarge extends TitleBarBase
// UrlInputListener implementation
@Override
- public void onAction(String text, String extra) {
+ public void onAction(String text, String extra, String source) {
mUiController.getCurrentTopWebView().requestFocus();
((BaseUi) mUiController.getUi()).hideFakeTitleBar();
Intent i = new Intent();
@@ -157,6 +159,11 @@ public class TitleBarXLarge extends TitleBarBase
if (extra != null) {
i.putExtra(SearchManager.EXTRA_DATA_KEY, extra);
}
+ if (source != null) {
+ Bundle appData = new Bundle();
+ appData.putString(com.android.common.Search.SOURCE, source);
+ i.putExtra(SearchManager.APP_DATA, appData);
+ }
mUiController.handleNewIntent(i);
setUrlMode(false);
setDisplayTitle(text);
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index a4c2be3..0abea12 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -38,6 +38,10 @@ public class UrlInputView extends AutoCompleteTextView
implements OnFocusChangeListener, OnEditorActionListener,
CompletionListener {
+
+ static final String TYPED = "browser-type";
+ static final String SUGGESTED = "browser-suggest";
+
private UrlInputListener mListener;
private InputMethodManager mInputManager;
private SuggestionsAdapter mAdapter;
@@ -121,7 +125,7 @@ public class UrlInputView extends AutoCompleteTextView
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- finishInput(getText().toString(), null);
+ finishInput(getText().toString(), null, TYPED);
return true;
}
@@ -130,7 +134,7 @@ public class UrlInputView extends AutoCompleteTextView
if (hasFocus) {
forceIme();
} else {
- finishInput(null, null);
+ finishInput(null, null, null);
}
if (mWrappedFocusListener != null) {
mWrappedFocusListener.onFocusChange(v, hasFocus);
@@ -145,14 +149,14 @@ public class UrlInputView extends AutoCompleteTextView
mInputManager.showSoftInput(this, 0);
}
- private void finishInput(String url, String extra) {
+ private void finishInput(String url, String extra, String source) {
this.dismissDropDown();
this.setSelection(0,0);
mInputManager.hideSoftInputFromWindow(getWindowToken(), 0);
if (TextUtils.isEmpty(url)) {
mListener.onDismiss();
} else {
- mListener.onAction(url, extra);
+ mListener.onAction(url, extra, source);
}
}
@@ -165,14 +169,14 @@ public class UrlInputView extends AutoCompleteTextView
@Override
public void onSelect(String url, String extra) {
- finishInput(url, extra);
+ finishInput(url, extra, SUGGESTED);
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent evt) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// catch back key in order to do slightly more cleanup than usual
- finishInput(null, null);
+ finishInput(null, null, null);
return true;
}
return super.onKeyPreIme(keyCode, evt);
@@ -182,7 +186,7 @@ public class UrlInputView extends AutoCompleteTextView
public void onDismiss();
- public void onAction(String text, String extra);
+ public void onAction(String text, String extra, String source);
public void onEdit(String text);