summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-11-19 00:43:22 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-11-19 00:43:22 +0000
commitdcdefbcc57480be5c32584cf75628d76da16ffe8 (patch)
treeea6dadabd510051cf5403d637b850d861974495e /src
parent7ece7a6a567bdbbfb3b9c53ef0158faeaaa7c4c3 (diff)
parent3be76c87bbf41c20b0cec56a5ae15268cce0dac4 (diff)
downloadpackages_apps_browser-dcdefbcc57480be5c32584cf75628d76da16ffe8.zip
packages_apps_browser-dcdefbcc57480be5c32584cf75628d76da16ffe8.tar.gz
packages_apps_browser-dcdefbcc57480be5c32584cf75628d76da16ffe8.tar.bz2
Merge commit 'android-4.2_r1' into mr1-staging
Change-Id: Id36dc68dabccb44bd69de5580c8441cf7a6b6049
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/BaseUi.java3
-rw-r--r--src/com/android/browser/BreadCrumbView.java2
-rw-r--r--src/com/android/browser/BrowserActivity.java1
-rw-r--r--src/com/android/browser/BrowserSettings.java15
-rw-r--r--src/com/android/browser/Controller.java41
-rw-r--r--src/com/android/browser/DownloadHandler.java12
-rw-r--r--src/com/android/browser/FetchUrlMimeType.java1
-rw-r--r--src/com/android/browser/IntentHandler.java8
-rw-r--r--src/com/android/browser/NavigationBarPhone.java7
-rw-r--r--src/com/android/browser/NavigationBarTablet.java8
-rw-r--r--src/com/android/browser/PhoneUi.java11
-rw-r--r--src/com/android/browser/PreloadController.java2
-rw-r--r--src/com/android/browser/PreloadedTabControl.java72
-rw-r--r--src/com/android/browser/Tab.java33
-rw-r--r--src/com/android/browser/TabControl.java2
-rw-r--r--src/com/android/browser/TitleBar.java8
-rw-r--r--src/com/android/browser/UrlHandler.java1
-rw-r--r--src/com/android/browser/WallpaperHandler.java7
-rw-r--r--src/com/android/browser/WebViewController.java2
19 files changed, 120 insertions, 116 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index db8f0e1..1165c53 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -139,7 +139,7 @@ public abstract class BaseUi implements UI {
R.id.fullscreen_custom_content);
mErrorConsoleContainer = (LinearLayout) frameLayout
.findViewById(R.id.error_console);
- setFullscreen(false);
+ setFullscreen(BrowserSettings.getInstance().useFullscreen());
mGenericFavicon = res.getDrawable(
R.drawable.app_web_browser_sm);
mTitleBar = new TitleBar(mActivity, mUiController, this,
@@ -174,6 +174,7 @@ public abstract class BaseUi implements UI {
if (ct != null) {
setActiveTab(ct);
}
+ mTitleBar.onResume();
}
protected boolean isActivityPaused() {
diff --git a/src/com/android/browser/BreadCrumbView.java b/src/com/android/browser/BreadCrumbView.java
index aa77744..d331b53 100644
--- a/src/com/android/browser/BreadCrumbView.java
+++ b/src/com/android/browser/BreadCrumbView.java
@@ -179,6 +179,8 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener {
LayoutParams.MATCH_PARENT));
mBackButton.setOnClickListener(this);
mBackButton.setVisibility(View.GONE);
+ mBackButton.setContentDescription(mContext.getText(
+ R.string.accessibility_button_bookmarks_folder_up));
addView(mBackButton, 0);
}
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 8511778..4166b11 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -43,6 +43,7 @@ public class BrowserActivity extends Activity {
public static final String ACTION_SHOW_BROWSER = "show_browser";
public static final String ACTION_RESTART = "--restart--";
private static final String EXTRA_STATE = "state";
+ public static final String EXTRA_DISABLE_URL_OVERRIDE = "disable_url_override";
private final static String LOGTAG = "browser";
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 9a0e74c..8dadfc8 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -376,8 +376,12 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
syncManagedSettings();
if (PREF_SEARCH_ENGINE.equals(key)) {
updateSearchEngine(false);
+ } else if (PREF_FULLSCREEN.equals(key)) {
+ if (mController != null && mController.getUi() != null) {
+ mController.getUi().setFullscreen(useFullscreen());
+ }
} else if (PREF_ENABLE_QUICK_CONTROLS.equals(key)) {
- if (mController.getUi() != null) {
+ if (mController != null && mController.getUi() != null) {
mController.getUi().setUseQuickControls(sharedPreferences.getBoolean(key, false));
}
} else if (PREF_LINK_PREFETCH.equals(key)) {
@@ -507,9 +511,14 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
.clear()
.putLong(GoogleAccountLogin.PREF_AUTOLOGIN_TIME, gal)
.apply();
+ resetCachedValues();
syncManagedSettings();
}
+ private void resetCachedValues() {
+ updateSearchEngine(false);
+ }
+
public AutoFillProfile getAutoFillProfile() {
return mAutofillHandler.getAutoFillProfile();
}
@@ -825,6 +834,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return HomeProvider.MOST_VISITED.equals(getHomePage());
}
+ public boolean useFullscreen() {
+ return mPrefs.getBoolean(PREF_FULLSCREEN, false);
+ }
+
public boolean useInvertedRendering() {
return mPrefs.getBoolean(PREF_INVERTED, false);
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 108a613..2b449ec 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -36,6 +36,7 @@ import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.Uri;
@@ -514,8 +515,8 @@ public class Controller
case R.id.save_link_context_menu_id:
case R.id.download_context_menu_id:
DownloadHandler.onDownloadStartNoStream(
- mActivity, url, null, null, null,
- view.isPrivateBrowsingEnabled());
+ mActivity, url, view.getSettings().getUserAgentString(),
+ null, null, null, view.isPrivateBrowsingEnabled());
break;
}
break;
@@ -871,11 +872,6 @@ public class Controller
public void onPageFinished(Tab tab) {
mCrashRecoveryHandler.backupState();
mUi.onTabDataChanged(tab);
- // pause the WebView timer and release the wake lock if it is finished
- // while BrowserActivity is in pause state.
- if (mActivityPaused && pauseWebViewTimers(tab)) {
- releaseWakeLock();
- }
// Performance probe
if (false) {
@@ -900,6 +896,10 @@ public class Controller
// onPageFinished has executed)
if (tab.inPageLoad()) {
updateInLoadMenuItems(mCachedMenu, tab);
+ } else if (mActivityPaused && pauseWebViewTimers(tab)) {
+ // pause the WebView timer and release the wake lock if it is
+ // finished while BrowserActivity is in pause state.
+ releaseWakeLock();
}
if (!tab.isPrivateBrowsingEnabled()
&& !TextUtils.isEmpty(tab.getUrl())
@@ -1043,10 +1043,11 @@ public class Controller
@Override
public void onDownloadStart(Tab tab, String url, String userAgent,
- String contentDisposition, String mimetype, long contentLength) {
+ String contentDisposition, String mimetype, String referer,
+ long contentLength) {
WebView w = tab.getWebView();
DownloadHandler.onDownloadStart(mActivity, url, userAgent,
- contentDisposition, mimetype, w.isPrivateBrowsingEnabled());
+ contentDisposition, mimetype, referer, w.isPrivateBrowsingEnabled());
if (w.copyBackForwardList().getSize() == 0) {
// This Tab was opened for the sole purpose of downloading a
// file. Remove it.
@@ -1480,9 +1481,9 @@ public class Controller
return false;
}
});
- menu.findItem(R.id.download_context_menu_id).
- setOnMenuItemClickListener(
- new Download(mActivity, extra, webview.isPrivateBrowsingEnabled()));
+ menu.findItem(R.id.download_context_menu_id).setOnMenuItemClickListener(
+ new Download(mActivity, extra, webview.isPrivateBrowsingEnabled(),
+ webview.getSettings().getUserAgentString()));
menu.findItem(R.id.set_wallpaper_context_menu_id).
setOnMenuItemClickListener(new WallpaperHandler(mActivity,
extra));
@@ -2198,6 +2199,10 @@ public class Controller
}
} catch (IllegalStateException e) {
// Ignore
+ } catch (SQLiteException s) {
+ // Added for possible error when user tries to remove the same bookmark
+ // that is being updated with a screen shot
+ Log.w(LOGTAG, "Error when running updateScreenshot ", s);
} finally {
if (cursor != null) cursor.close();
}
@@ -2224,6 +2229,7 @@ public class Controller
private Activity mActivity;
private String mText;
private boolean mPrivateBrowsing;
+ private String mUserAgent;
private static final String FALLBACK_EXTENSION = "dat";
private static final String IMAGE_BASE_FORMAT = "yyyy-MM-dd-HH-mm-ss-";
@@ -2232,16 +2238,18 @@ public class Controller
if (DataUri.isDataUri(mText)) {
saveDataUri();
} else {
- DownloadHandler.onDownloadStartNoStream(mActivity, mText, null,
- null, null, mPrivateBrowsing);
+ DownloadHandler.onDownloadStartNoStream(mActivity, mText, mUserAgent,
+ null, null, null, mPrivateBrowsing);
}
return true;
}
- public Download(Activity activity, String toDownload, boolean privateBrowsing) {
+ public Download(Activity activity, String toDownload, boolean privateBrowsing,
+ String userAgent) {
mActivity = activity;
mText = toDownload;
mPrivateBrowsing = privateBrowsing;
+ mUserAgent = userAgent;
}
/**
@@ -2633,6 +2641,9 @@ public class Controller
if (data.isPreloaded()) {
// this isn't called for preloaded tabs
} else {
+ if (t != null && data.mDisableUrlOverride) {
+ t.disableUrlOverridingForLoad();
+ }
loadUrl(t, data.mUrl, data.mHeaders);
}
}
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index 87e0e27..dee10ae 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -21,7 +21,6 @@ import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
-import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -53,11 +52,12 @@ public class DownloadHandler {
* @param userAgent User agent of the downloading application.
* @param contentDisposition Content-disposition http header, if present.
* @param mimetype The mimetype of the content reported by the server
+ * @param referer The referer associated with the downloaded url
* @param privateBrowsing If the request is coming from a private browsing tab.
*/
public static void onDownloadStart(Activity activity, String url,
String userAgent, String contentDisposition, String mimetype,
- boolean privateBrowsing) {
+ String referer, boolean privateBrowsing) {
// if we're dealing wih A/V content that's not explicitly marked
// for download, check if it's streamable.
if (contentDisposition == null
@@ -67,7 +67,6 @@ public class DownloadHandler {
// that matches.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), mimetype);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ResolveInfo info = activity.getPackageManager().resolveActivity(intent,
PackageManager.MATCH_DEFAULT_ONLY);
if (info != null) {
@@ -96,7 +95,7 @@ public class DownloadHandler {
}
}
onDownloadStartNoStream(activity, url, userAgent, contentDisposition,
- mimetype, privateBrowsing);
+ mimetype, referer, privateBrowsing);
}
// This is to work around the fact that java.net.URI throws Exceptions
@@ -137,11 +136,12 @@ public class DownloadHandler {
* @param userAgent User agent of the downloading application.
* @param contentDisposition Content-disposition http header, if present.
* @param mimetype The mimetype of the content reported by the server
+ * @param referer The referer associated with the downloaded url
* @param privateBrowsing If the request is coming from a private browsing tab.
*/
/*package */ static void onDownloadStartNoStream(Activity activity,
String url, String userAgent, String contentDisposition,
- String mimetype, boolean privateBrowsing) {
+ String mimetype, String referer, boolean privateBrowsing) {
String filename = URLUtil.guessFileName(url,
contentDisposition, mimetype);
@@ -204,6 +204,8 @@ public class DownloadHandler {
// old percent-encoded url.
String cookies = CookieManager.getInstance().getCookie(url, privateBrowsing);
request.addRequestHeader("cookie", cookies);
+ request.addRequestHeader("User-Agent", userAgent);
+ request.addRequestHeader("Referer", referer);
request.setNotificationVisibility(
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
if (mimetype == null) {
diff --git a/src/com/android/browser/FetchUrlMimeType.java b/src/com/android/browser/FetchUrlMimeType.java
index 07c9b93..33b5808 100644
--- a/src/com/android/browser/FetchUrlMimeType.java
+++ b/src/com/android/browser/FetchUrlMimeType.java
@@ -121,6 +121,7 @@ class FetchUrlMimeType extends Thread {
MimeTypeMap.getSingleton().getMimeTypeFromExtension(
MimeTypeMap.getFileExtensionFromUrl(mUri));
if (newMimeType != null) {
+ mimeType = newMimeType;
mRequest.setMimeType(newMimeType);
}
}
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index e22c5dc..f0998a4 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -335,12 +335,14 @@ public class IntentHandler {
final Map<String, String> mHeaders;
final PreloadedTabControl mPreloadedTab;
final String mSearchBoxQueryToSubmit;
+ final boolean mDisableUrlOverride;
UrlData(String url) {
this.mUrl = url;
this.mHeaders = null;
this.mPreloadedTab = null;
this.mSearchBoxQueryToSubmit = null;
+ this.mDisableUrlOverride = false;
}
UrlData(String url, Map<String, String> headers, Intent intent) {
@@ -353,6 +355,12 @@ public class IntentHandler {
this.mHeaders = headers;
this.mPreloadedTab = preloaded;
this.mSearchBoxQueryToSubmit = searchBoxQueryToSubmit;
+ if (intent != null) {
+ mDisableUrlOverride = intent.getBooleanExtra(
+ BrowserActivity.EXTRA_DISABLE_URL_OVERRIDE, false);
+ } else {
+ mDisableUrlOverride = false;
+ }
}
boolean isEmpty() {
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index c3930d3..f3eaa2a 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -215,12 +215,12 @@ public class NavigationBarPhone extends NavigationBarBase implements
@Override
public void onStateChanged(int state) {
+ mVoiceButton.setVisibility(View.GONE);
switch(state) {
case StateListener.STATE_NORMAL:
mComboIcon.setVisibility(View.VISIBLE);
mStopButton.setVisibility(View.GONE);
mClearButton.setVisibility(View.GONE);
- mVoiceButton.setVisibility(View.GONE);
mMagnify.setVisibility(View.GONE);
mTabSwitcher.setVisibility(View.VISIBLE);
mTitleContainer.setBackgroundDrawable(null);
@@ -230,7 +230,9 @@ public class NavigationBarPhone extends NavigationBarBase implements
mComboIcon.setVisibility(View.GONE);
mStopButton.setVisibility(View.VISIBLE);
mClearButton.setVisibility(View.GONE);
- mVoiceButton.setVisibility(View.VISIBLE);
+ if ((mUiController != null) && mUiController.supportsVoice()) {
+ mVoiceButton.setVisibility(View.VISIBLE);
+ }
mMagnify.setVisibility(View.GONE);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
@@ -240,7 +242,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
mComboIcon.setVisibility(View.GONE);
mStopButton.setVisibility(View.GONE);
mClearButton.setVisibility(View.VISIBLE);
- mVoiceButton.setVisibility(View.GONE);
mMagnify.setVisibility(View.VISIBLE);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index 79c8de6..adfd5e7 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -322,19 +322,19 @@ public class NavigationBarTablet extends NavigationBarBase implements StateListe
@Override
public void onStateChanged(int state) {
+ mVoiceButton.setVisibility(View.GONE);
switch(state) {
case STATE_NORMAL:
mClearButton.setVisibility(View.GONE);
- mVoiceButton.setVisibility(View.GONE);
-
break;
case STATE_HIGHLIGHTED:
mClearButton.setVisibility(View.GONE);
- mVoiceButton.setVisibility(View.VISIBLE);
+ if ((mUiController != null) && mUiController.supportsVoice()) {
+ mVoiceButton.setVisibility(View.VISIBLE);
+ }
break;
case STATE_EDITED:
mClearButton.setVisibility(View.VISIBLE);
- mVoiceButton.setVisibility(View.GONE);
break;
}
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index dc3b863..a405522 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -54,6 +54,7 @@ public class PhoneUi extends BaseUi {
private int mActionBarHeight;
boolean mAnimating;
+ boolean mShowNav = false;
/**
* @param browser
@@ -80,6 +81,8 @@ public class PhoneUi extends BaseUi {
if (mUseQuickControls) {
mTitleBar.setShowProgressOnly(false);
}
+ //Do nothing while at Nav show screen.
+ if (mShowNav) return;
super.editUrl(clearInput, forceIME);
}
@@ -131,6 +134,12 @@ public class PhoneUi extends BaseUi {
mTitleBar.cancelTitleBarAnimation(true);
mTitleBar.setSkipTitleBarAnimations(true);
super.setActiveTab(tab);
+
+ //if at Nav screen show, detach tab like what showNavScreen() do.
+ if (mShowNav) {
+ detachTab(mActiveTab);
+ }
+
BrowserWebView view = (BrowserWebView) tab.getWebView();
// TabControl.setCurrentTab has been called before this,
// so the tab is guaranteed to have a webview
@@ -258,6 +267,7 @@ public class PhoneUi extends BaseUi {
}
void showNavScreen() {
+ mShowNav = true;
mUiController.setBlockEvents(true);
if (mNavScreen == null) {
mNavScreen = new NavScreen(mActivity, mUiController, this);
@@ -338,6 +348,7 @@ public class PhoneUi extends BaseUi {
}
void hideNavScreen(int position, boolean animate) {
+ mShowNav = false;
if (!showingNavScreen()) return;
final Tab tab = mUiController.getTabControl().getTab(position);
if ((tab == null) || !animate) {
diff --git a/src/com/android/browser/PreloadController.java b/src/com/android/browser/PreloadController.java
index a7feaee..881f19e 100644
--- a/src/com/android/browser/PreloadController.java
+++ b/src/com/android/browser/PreloadController.java
@@ -153,7 +153,7 @@ public class PreloadController implements WebViewController {
@Override
public void onDownloadStart(Tab tab, String url, String useragent,
String contentDisposition, String mimeType,
- long contentLength) {
+ String referer, long contentLength) {
if (LOGD_ENABLED) Log.d(LOGTAG, "onDownloadStart()");
}
diff --git a/src/com/android/browser/PreloadedTabControl.java b/src/com/android/browser/PreloadedTabControl.java
index 0b2956f..21dafa9 100644
--- a/src/com/android/browser/PreloadedTabControl.java
+++ b/src/com/android/browser/PreloadedTabControl.java
@@ -18,7 +18,6 @@ package com.android.browser;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
-import android.webkit.SearchBox;
import java.util.Map;
import java.util.regex.Pattern;
@@ -39,83 +38,16 @@ public class PreloadedTabControl {
mTab = t;
}
- private void maybeSetQuery(final String query, SearchBox sb) {
- if (!TextUtils.equals(mLastQuery, query)) {
- if (sb != null) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "Changing searchbox query to " + query);
- sb.setVerbatim(true);
- sb.setQuery(query);
- sb.onchange(new SearchBox.SearchBoxListener() {
- @Override
- public void onChangeComplete(boolean called) {
- if (mDestroyed) return;
- if (LOGD_ENABLED) Log.d(LOGTAG, "Changed searchbox query: " + called);
- if (called) {
- mLastQuery = query;
- }
- }
- });
- } else {
- if (LOGD_ENABLED) Log.d(LOGTAG, "Cannot set query: no searchbox interface");
- }
- }
- }
-
public void setQuery(String query) {
- maybeSetQuery(query, mTab.getWebViewClassic().getSearchBox());
+ if (LOGD_ENABLED) Log.d(LOGTAG, "Cannot set query: no searchbox interface");
}
public boolean searchBoxSubmit(final String query,
final String fallbackUrl, final Map<String, String> fallbackHeaders) {
- final SearchBox sb = mTab.getWebViewClassic().getSearchBox();
- if (sb == null) {
- // no searchbox, cannot submit. Fallback to regular tab creation
- if (LOGD_ENABLED) Log.d(LOGTAG, "No searchbox, cannot submit query");
- return false;
- }
- maybeSetQuery(query, sb);
- if (LOGD_ENABLED) Log.d(LOGTAG, "Submitting query " + query);
- final String currentUrl = mTab.getUrl();
- sb.onsubmit(new SearchBox.SearchBoxListener() {
- @Override
- public void onSubmitComplete(boolean called) {
- if (mDestroyed) return;
- if (LOGD_ENABLED) Log.d(LOGTAG, "Query submitted: " + called);
- if (!called) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "Query not submitted; falling back");
- loadUrl(fallbackUrl, fallbackHeaders);
- // make sure that the failed, preloaded URL is cleared from the back stack
- mTab.clearBackStackWhenItemAdded(Pattern.compile(
- "^" + Pattern.quote(fallbackUrl) + "$"));
- } else {
- // ignore the next fragment change, to avoid leaving a blank page in the browser
- // after the query has been submitted.
- String currentWithoutFragment = Uri.parse(currentUrl)
- .buildUpon()
- .fragment(null)
- .toString();
- mTab.clearBackStackWhenItemAdded(
- Pattern.compile(
- "^" +
- Pattern.quote(currentWithoutFragment) +
- "(\\#.*)?" +
- "$"));
- }
- }});
- return true;
+ return false;
}
public void searchBoxCancel() {
- SearchBox sb = mTab.getWebViewClassic().getSearchBox();
- if (sb != null) {
- mLastQuery = null;
- sb.oncancel(new SearchBox.SearchBoxListener(){
- @Override
- public void onCancelComplete(boolean called) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "Query cancelled: " + called);
- }
- });
- }
}
public void loadUrlIfChanged(String url, Map<String, String> headers) {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 6200286..b5000c2 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -46,9 +46,9 @@ import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewStub;
+import android.webkit.BrowserDownloadListener;
import android.webkit.ClientCertRequestHandler;
import android.webkit.ConsoleMessage;
-import android.webkit.DownloadListener;
import android.webkit.GeolocationPermissions;
import android.webkit.HttpAuthHandler;
import android.webkit.SslErrorHandler;
@@ -64,6 +64,7 @@ import android.webkit.WebView;
import android.webkit.WebView.PictureListener;
import android.webkit.WebViewClassic;
import android.webkit.WebViewClient;
+import android.webkit.WebViewClientClassicExt;
import android.widget.CheckBox;
import android.widget.Toast;
@@ -155,6 +156,7 @@ class Tab implements PictureListener {
// If true, the tab is in page loading state (after onPageStarted,
// before onPageFinsihed)
private boolean mInPageLoad;
+ private boolean mDisableOverrideUrlLoading;
// The last reported progress of the current page
private int mPageLoadProgress;
// The time the load started, used to find load page time
@@ -170,7 +172,7 @@ class Tab implements PictureListener {
private ErrorConsoleView mErrorConsole;
// The listener that gets invoked when a download is started from the
// mMainView
- private final DownloadListener mDownloadListener;
+ private final BrowserDownloadListener mDownloadListener;
// Listener used to know when we move forward or back in the history list.
private final WebBackForwardListClient mWebBackForwardListClient;
private DataController mDataController;
@@ -322,7 +324,7 @@ class Tab implements PictureListener {
// WebViewClient implementation for the main WebView
// -------------------------------------------------------------------------
- private final WebViewClient mWebViewClient = new WebViewClient() {
+ private final WebViewClientClassicExt mWebViewClient = new WebViewClientClassicExt() {
private Message mDontResend;
private Message mResend;
@@ -372,6 +374,7 @@ class Tab implements PictureListener {
@Override
public void onPageFinished(WebView view, String url) {
+ mDisableOverrideUrlLoading = false;
if (!isPrivateBrowsingEnabled()) {
LogTag.logPageFinishedLoading(
url, SystemClock.uptimeMillis() - mLoadStartTime);
@@ -383,7 +386,7 @@ class Tab implements PictureListener {
// return true if want to hijack the url to let another app to handle it
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- if (mInForeground) {
+ if (!mDisableOverrideUrlLoading && mInForeground) {
return mWebViewController.shouldOverrideUrlLoading(Tab.this,
view, url);
} else {
@@ -1045,12 +1048,12 @@ class Tab implements PictureListener {
// Subclass of WebViewClient used in subwindows to notify the main
// WebViewClient of certain WebView activities.
- private static class SubWindowClient extends WebViewClient {
+ private static class SubWindowClient extends WebViewClientClassicExt {
// The main WebViewClient.
- private final WebViewClient mClient;
+ private final WebViewClientClassicExt mClient;
private final WebViewController mController;
- SubWindowClient(WebViewClient client, WebViewController controller) {
+ SubWindowClient(WebViewClientClassicExt client, WebViewController controller) {
mClient = client;
mController = controller;
}
@@ -1157,12 +1160,12 @@ class Tab implements PictureListener {
mInPageLoad = false;
mInForeground = false;
- mDownloadListener = new DownloadListener() {
+ mDownloadListener = new BrowserDownloadListener() {
public void onDownloadStart(String url, String userAgent,
- String contentDisposition, String mimetype,
+ String contentDisposition, String mimetype, String referer,
long contentLength) {
mWebViewController.onDownloadStart(Tab.this, url, userAgent, contentDisposition,
- mimetype, contentLength);
+ mimetype, referer, contentLength);
}
};
mWebBackForwardListClient = new WebBackForwardListClient() {
@@ -1351,12 +1354,12 @@ class Tab implements PictureListener {
mWebChromeClient));
// Set a different DownloadListener for the mSubView, since it will
// just need to dismiss the mSubView, rather than close the Tab
- mSubView.setDownloadListener(new DownloadListener() {
+ mSubView.setDownloadListener(new BrowserDownloadListener() {
public void onDownloadStart(String url, String userAgent,
- String contentDisposition, String mimetype,
+ String contentDisposition, String mimetype, String referer,
long contentLength) {
mWebViewController.onDownloadStart(Tab.this, url, userAgent,
- contentDisposition, mimetype, contentLength);
+ contentDisposition, mimetype, referer, contentLength);
if (mSubView.copyBackForwardList().getSize() == 0) {
// This subwindow was opened for the sole purpose of
// downloading a file. Remove it.
@@ -1894,6 +1897,10 @@ class Tab implements PictureListener {
}
}
+ public void disableUrlOverridingForLoad() {
+ mDisableOverrideUrlLoading = true;
+ }
+
protected void capture() {
if (mMainView == null || mCapture == null) return;
if (mMainView.getContentWidth() <= 0 || mMainView.getContentHeight() <= 0) {
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 993cd11..150ece0 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -571,7 +571,7 @@ class TabControl {
}
final WebView subview = t.getSubWebView();
if (subview != null) {
- webview.stopLoading();
+ subview.stopLoading();
}
}
}
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index f5be5d3..874296a 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -26,6 +26,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
+import android.view.accessibility.AccessibilityManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
@@ -47,6 +48,7 @@ public class TitleBar extends RelativeLayout {
private BaseUi mBaseUi;
private FrameLayout mContentView;
private PageProgressView mProgress;
+ private AccessibilityManager mAccessibilityManager;
private AutologinBar mAutoLogin;
private NavigationBarBase mNavBar;
@@ -66,6 +68,7 @@ public class TitleBar extends RelativeLayout {
mUiController = controller;
mBaseUi = ui;
mContentView = contentView;
+ mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
initLayout(context);
setFixedTitleBar();
}
@@ -118,6 +121,7 @@ public class TitleBar extends RelativeLayout {
private void setFixedTitleBar() {
boolean isFixed = !mUseQuickControls
&& !mContext.getResources().getBoolean(R.bool.hide_title);
+ isFixed |= mAccessibilityManager.isEnabled();
// If getParent() returns null, we are initializing
ViewGroup parent = (ViewGroup)getParent();
if (mIsFixedTitleBar == isFixed && parent != null) return;
@@ -436,4 +440,8 @@ public class TitleBar extends RelativeLayout {
}
}
+ public void onResume() {
+ setFixedTitleBar();
+ }
+
}
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java
index ac4b880..167d410 100644
--- a/src/com/android/browser/UrlHandler.java
+++ b/src/com/android/browser/UrlHandler.java
@@ -175,6 +175,7 @@ public class UrlHandler {
return false;
}
try {
+ intent.putExtra(BrowserActivity.EXTRA_DISABLE_URL_OVERRIDE, true);
if (mActivity.startActivityIfNeeded(intent, -1)) {
// before leaving BrowserActivity, close the empty child tab.
// If a new tab is created through JavaScript open to load this
diff --git a/src/com/android/browser/WallpaperHandler.java b/src/com/android/browser/WallpaperHandler.java
index b76861c..0c60664 100644
--- a/src/com/android/browser/WallpaperHandler.java
+++ b/src/com/android/browser/WallpaperHandler.java
@@ -130,7 +130,12 @@ public class WallpaperHandler extends Thread
}
Bitmap scaledWallpaper = BitmapFactory.decodeStream(inputstream,
null, options);
- wm.setBitmap(scaledWallpaper);
+ if (scaledWallpaper != null) {
+ wm.setBitmap(scaledWallpaper);
+ } else {
+ Log.e(LOGTAG, "Unable to set new wallpaper, " +
+ "decodeStream returned null.");
+ }
}
} catch (IOException e) {
Log.e(LOGTAG, "Unable to set new wallpaper");
diff --git a/src/com/android/browser/WebViewController.java b/src/com/android/browser/WebViewController.java
index fef6964..e814ff9 100644
--- a/src/com/android/browser/WebViewController.java
+++ b/src/com/android/browser/WebViewController.java
@@ -73,7 +73,7 @@ public interface WebViewController {
final String host, final String realm);
void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
- String mimeType, long contentLength);
+ String mimeType, String referer, long contentLength);
void showCustomView(Tab tab, View view, int requestedOrientation,
WebChromeClient.CustomViewCallback callback);