diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/browser/BrowserSettings.java | 20 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 18 |
2 files changed, 31 insertions, 7 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index 3d5ca03d..769dfca1 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -137,12 +137,20 @@ class BrowserSettings extends Observable { "privacy_clear_geolocation_access"; private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " + - "U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, " + - "like Gecko) Version/4.0 Safari/530.17"; + "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " + + "like Gecko) Version/5.0 Safari/533.16"; private static final String IPHONE_USERAGENT = "Mozilla/5.0 (iPhone; U; " + - "CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 " + - "(KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"; + "CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 " + + "(KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"; + + private static final String IPAD_USERAGENT = "Mozilla/5.0 (iPad; U; " + + "CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 " + + "(KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10"; + + private static final String FROYO_USERAGENT = "Mozilla/5.0 (Linux; U; " + + "Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 " + + "(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"; // Value to truncate strings when adding them to a TextView within // a ListView @@ -182,6 +190,10 @@ class BrowserSettings extends Observable { s.setUserAgentString(DESKTOP_USERAGENT); } else if (b.userAgent == 2) { s.setUserAgentString(IPHONE_USERAGENT); + } else if (b.userAgent == 3) { + s.setUserAgentString(IPAD_USERAGENT); + } else if (b.userAgent == 4) { + s.setUserAgentString(FROYO_USERAGENT); } s.setUseWideViewPort(b.useWideViewPort); s.setLoadsImagesAutomatically(b.loadsImagesAutomatically); diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index b31abc24..5795b05d 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -171,8 +171,8 @@ class Tab { return mVoiceSearchData != null; } /** - * Return true if the voice search Intent came with a String identifying - * that Google provided the Intent. + * Return true if the Tab is in voice search mode and the voice search + * Intent came with a String identifying that Google provided the Intent. */ public boolean voiceSearchSourceIsGoogle() { return mVoiceSearchData != null && mVoiceSearchData.mSourceIsGoogle; @@ -529,6 +529,18 @@ class Tab { // return true if want to hijack the url to let another app to handle it @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { + if (voiceSearchSourceIsGoogle()) { + // This method is called when the user clicks on a link. + // VoiceSearchMode is turned off when the user leaves the + // Google results page, so at this point the user must be on + // that page. If the user clicked a link on that page, assume + // that the voice search was effective, and broadcast an Intent + // so a receiver can take note of that fact. + Intent logIntent = new Intent(LoggingEvents.ACTION_LOG_EVENT); + logIntent.putExtra(LoggingEvents.EXTRA_EVENT, + LoggingEvents.VoiceSearch.RESULT_CLICKED); + mActivity.sendBroadcast(logIntent); + } if (mInForeground) { return mActivity.shouldOverrideUrlLoading(view, url); } else { @@ -1433,7 +1445,7 @@ class Tab { if (mSubView.copyBackForwardList().getSize() == 0) { // This subwindow was opened for the sole purpose of // downloading a file. Remove it. - dismissSubWindow(); + mActivity.dismissSubWindow(Tab.this); } } }); |