auto import from //branches/cupcake_rel/...@141571
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index bd6fdc6..f55ebb3 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -137,7 +137,7 @@
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.List;
+import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Vector;
 import java.util.regex.Matcher;
@@ -2938,6 +2938,73 @@
                 .show();
         }
 
+        // Container class for the next error dialog that needs to be
+        // displayed.
+        class ErrorDialog {
+            public final int mTitle;
+            public final String mDescription;
+            public final int mError;
+            ErrorDialog(int title, String desc, int error) {
+                mTitle = title;
+                mDescription = desc;
+                mError = error;
+            }
+        };
+
+        private void processNextError() {
+            if (mQueuedErrors == null) {
+                return;
+            }
+            // The first one is currently displayed so just remove it.
+            mQueuedErrors.removeFirst();
+            if (mQueuedErrors.size() == 0) {
+                mQueuedErrors = null;
+                return;
+            }
+            showError(mQueuedErrors.getFirst());
+        }
+
+        private DialogInterface.OnDismissListener mDialogListener =
+                new DialogInterface.OnDismissListener() {
+                    public void onDismiss(DialogInterface d) {
+                        processNextError();
+                    }
+                };
+        private LinkedList<ErrorDialog> mQueuedErrors;
+
+        private void queueError(int err, String desc) {
+            if (mQueuedErrors == null) {
+                mQueuedErrors = new LinkedList<ErrorDialog>();
+            }
+            for (ErrorDialog d : mQueuedErrors) {
+                if (d.mError == err) {
+                    // Already saw a similar error, ignore the new one.
+                    return;
+                }
+            }
+            ErrorDialog errDialog = new ErrorDialog(
+                    err == EventHandler.FILE_NOT_FOUND_ERROR ?
+                    R.string.browserFrameFileErrorLabel :
+                    R.string.browserFrameNetworkErrorLabel,
+                    desc, err);
+            mQueuedErrors.addLast(errDialog);
+
+            // Show the dialog now if the queue was empty.
+            if (mQueuedErrors.size() == 1) {
+                showError(errDialog);
+            }
+        }
+
+        private void showError(ErrorDialog errDialog) {
+            AlertDialog d = new AlertDialog.Builder(BrowserActivity.this)
+                    .setTitle(errDialog.mTitle)
+                    .setMessage(errDialog.mDescription)
+                    .setPositiveButton(R.string.ok, null)
+                    .create();
+            d.setOnDismissListener(mDialogListener);
+            d.show();
+        }
+
         /**
          * Show a dialog informing the user of the network error reported by
          * WebCore.
@@ -2950,15 +3017,10 @@
                     errorCode != EventHandler.ERROR_BAD_URL &&
                     errorCode != EventHandler.ERROR_UNSUPPORTED_SCHEME &&
                     errorCode != EventHandler.FILE_ERROR) {
-                new AlertDialog.Builder(BrowserActivity.this)
-                        .setTitle((errorCode == EventHandler.FILE_NOT_FOUND_ERROR) ?
-                                         R.string.browserFrameFileErrorLabel :
-                                         R.string.browserFrameNetworkErrorLabel)
-                        .setMessage(description)
-                        .setPositiveButton(R.string.ok, null)
-                        .show();
+                queueError(errorCode, description);
             }
-            Log.e(LOGTAG, "onReceivedError code:"+errorCode+" "+description);
+            Log.e(LOGTAG, "onReceivedError " + errorCode + " " + failingUrl
+                    + " " + description);
 
             // We need to reset the title after an error.
             resetTitleAndRevertLockIcon();
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index a7d45f9..050b24b 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -222,7 +222,7 @@
         i.putExtra(Intent.EXTRA_SHORTCUT_NAME, title);
         i.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                 Intent.ShortcutIconResource.fromContext(BrowserBookmarksPage.this,
-                        R.drawable.ic_launcher_browser));
+                        R.drawable.ic_launcher_shortcut_browser_bookmark));
         // Do not allow duplicate items
         i.putExtra("duplicate", false);
         return i;
diff --git a/src/com/android/browser/FindDialog.java b/src/com/android/browser/FindDialog.java
index 43cd1c4..6e9574c 100644
--- a/src/com/android/browser/FindDialog.java
+++ b/src/com/android/browser/FindDialog.java
@@ -179,7 +179,7 @@
         Spannable span = (Spannable) mEditText.getText();
         span.setSpan(this, 0, span.length(), 
                      Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-        mMatches.setText(R.string.zero);
+        setMatchesFound(0);
         disableButtons();
     }
     
@@ -206,11 +206,11 @@
         } else {
             mMatchesView.setVisibility(View.VISIBLE);
             int found = mWebView.findAll(find.toString());
-            mMatches.setText(Integer.toString(found));
+            setMatchesFound(found);
             if (found < 2) {
                 disableButtons();
                 if (found == 0) {
-                    mMatches.setText(R.string.zero);
+                    setMatchesFound(0);
                 }
             } else {
                 mPrevButton.setFocusable(true);
@@ -221,6 +221,13 @@
         }
     }
 
+    private void setMatchesFound(int found) {
+        String template = mBrowserActivity.getResources().
+                getQuantityString(R.plurals.matches_found, found, found);
+
+        mMatches.setText(template);
+    }
+
     public void afterTextChanged(Editable s) {
     }
 }