Don't save in download history when in incognito

Change-Id: Icab011fffb93cfe98ae3e9d8b066c18b3b62cc3a
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index 1e969c5..88e6679 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -102,6 +102,7 @@
         request.addRequestHeader("cookie", cookies);
         request.addRequestHeader("User-Agent", userAgent);
         request.addRequestHeader("Referer", referer);
+        request.setVisibleInDownloadsUi(!privateBrowsing);
         request.setNotificationVisibility(
                 DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
         final DownloadManager manager = (DownloadManager) activity
@@ -111,7 +112,7 @@
                 manager.enqueue(request);
             }
         }.start();
-        showStartDownloadToast(activity);
+        showStartDownloadToast(activity, privateBrowsing);
     }
 
     private static boolean isAudioFileType(int fileType){
@@ -421,9 +422,14 @@
         return false;
     }
 
-    public static void showStartDownloadToast(Activity activity) {
-        Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
-        activity.startActivity(intent);
+    public static void showStartDownloadToast(Activity activity,
+            boolean privateBrowsing) {
+        if (!privateBrowsing) {
+            Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
+            activity.startActivity(intent);
+        } else {
+            activity.finish();
+        }
         Toast.makeText(activity, R.string.download_pending, Toast.LENGTH_SHORT)
                 .show();
     }