OSDN Git Service

Use the system downloads UI, instead of browser specific 1.
[android-x86/packages-apps-Browser.git] / src / com / android / browser / BrowserActivity.java
index e98ab43..101157c 100644 (file)
@@ -47,6 +47,7 @@ import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.net.ConnectivityManager;
+import android.net.DownloadManager;
 import android.net.NetworkInfo;
 import android.net.Uri;
 import android.net.WebAddress;
@@ -191,6 +192,9 @@ public class BrowserActivity extends Activity
 
         mResolver = getContentResolver();
 
+        // Keep a settings instance handy.
+        mSettings = BrowserSettings.getInstance();
+
         // If this was a web search request, pass it on to the default web
         // search provider and finish this activity.
         if (handleWebSearchIntent(getIntent())) {
@@ -225,8 +229,6 @@ public class BrowserActivity extends Activity
         // Open the icon database and retain all the bookmark urls for favicons
         retainIconsOnStartup();
 
-        // Keep a settings instance handy.
-        mSettings = BrowserSettings.getInstance();
         mSettings.setTabControl(mTabControl);
 
         PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
@@ -1287,7 +1289,6 @@ public class BrowserActivity extends Activity
     }
 
     private WebView showDialog(WebDialog dialog) {
-        // Need to do something special for Tablet
         Tab tab = mTabControl.getCurrentTab();
         if (tab.getSubWebView() == null) {
             // If the find or select is being performed on the main webview,
@@ -1399,7 +1400,14 @@ public class BrowserActivity extends Activity
                 break;
 
             case R.id.select_text_id:
-                showSelectDialog();
+                if (true) {
+                    Tab currentTab = mTabControl.getCurrentTab();
+                    if (currentTab != null) {
+                        currentTab.getWebView().setUpSelect();
+                    }
+                } else {
+                    showSelectDialog();
+                }
                 break;
 
             case R.id.page_info_menu_id:
@@ -1440,7 +1448,7 @@ public class BrowserActivity extends Activity
                 break;
 
             case R.id.view_downloads_menu_id:
-                viewDownloads(null);
+                viewDownloads();
                 break;
 
             case R.id.window_one_menu_id:
@@ -3559,12 +3567,9 @@ public class BrowserActivity extends Activity
      * menu to see the download window. It shows the download window on top of
      * the current window.
      */
-    private void viewDownloads(Uri downloadRecord) {
-        Intent intent = new Intent(this,
-                BrowserDownloadPage.class);
-        intent.setData(downloadRecord);
-        startActivityForResult(intent, BrowserActivity.DOWNLOAD_PAGE);
-
+    private void viewDownloads() {
+        Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
+        startActivity(intent);
     }
 
     /**
@@ -3737,11 +3742,15 @@ public class BrowserActivity extends Activity
             // Nothing to do.
             return;
         }
+        Tab t = mTabControl.getCurrentTab();
+        if (t == null) {
+            // There is no current tab so we cannot toggle the error console
+            return;
+        }
 
         mShouldShowErrorConsole = flag;
 
-        ErrorConsoleView errorConsole = mTabControl.getCurrentTab()
-                .getErrorConsole(true);
+        ErrorConsoleView errorConsole = t.getErrorConsole(true);
 
         if (flag) {
             // Setting the show state of the console will cause it's the layout to be inflated.
@@ -3983,7 +3992,6 @@ public class BrowserActivity extends Activity
 
     // activity requestCode
     final static int COMBO_PAGE                 = 1;
-    final static int DOWNLOAD_PAGE              = 2;
     final static int PREFERENCES_PAGE           = 3;
     final static int FILE_SELECTED              = 4;