diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/Controller.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index ebfd56f..7f40aea 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -512,8 +512,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, view.isPrivateBrowsingEnabled()); break; } break; @@ -860,11 +860,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) { @@ -889,6 +884,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()) @@ -1433,9 +1432,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)); @@ -2165,6 +2164,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-"; @@ -2173,16 +2173,18 @@ public class Controller if (DataUri.isDataUri(mText)) { saveDataUri(); } else { - DownloadHandler.onDownloadStartNoStream(mActivity, mText, null, + DownloadHandler.onDownloadStartNoStream(mActivity, mText, mUserAgent, 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; } /** |