Shows the right URL that has a cert error.

b/2689122 SSL error shows the wrong page when triggered by an image/javascript in the page
This CL receives the URL which has a invalid cert from framework and shows it in related
dialogues. Related CLs are:
  webkit: https://android-git.corp.google.com/g/#change,117817
  framework: https://android-git.corp.google.com/g/#change,117828

Change-Id: I9b243b73b9cce19d94cc71608207219bfa687db2
diff --git a/src/com/android/browser/PageDialogsHandler.java b/src/com/android/browser/PageDialogsHandler.java
index 2dbddf3..b9e0859 100644
--- a/src/com/android/browser/PageDialogsHandler.java
+++ b/src/com/android/browser/PageDialogsHandler.java
@@ -42,6 +42,7 @@
     private Context mContext;
     private Controller mController;
     private boolean mPageInfoFromShowSSLCertificateOnError;
+    private String mUrlCertificateOnError;
     private Tab mPageInfoView;
     private AlertDialog mPageInfoDialog;
 
@@ -66,7 +67,9 @@
     public void onConfigurationChanged(Configuration config) {
         if (mPageInfoDialog != null) {
             mPageInfoDialog.dismiss();
-            showPageInfo(mPageInfoView, mPageInfoFromShowSSLCertificateOnError);
+            showPageInfo(mPageInfoView,
+                         mPageInfoFromShowSSLCertificateOnError,
+                         mUrlCertificateOnError);
         }
         if (mSSLCertificateDialog != null) {
             mSSLCertificateDialog.dismiss();
@@ -74,8 +77,9 @@
         }
         if (mSSLCertificateOnErrorDialog != null) {
             mSSLCertificateOnErrorDialog.dismiss();
-            showSSLCertificateOnError(mSSLCertificateOnErrorView, mSSLCertificateOnErrorHandler,
-                    mSSLCertificateOnErrorError);
+            showSSLCertificateOnError(mSSLCertificateOnErrorView,
+                                      mSSLCertificateOnErrorHandler,
+                                      mSSLCertificateOnErrorError);
         }
         if (mHttpAuthenticationDialog != null) {
             mHttpAuthenticationDialog.reshow();
@@ -129,16 +133,19 @@
      * this dialog was opened from the SSL-certificate-on-error dialog or
      * not. This is important, since we need to know whether to return to
      * the parent dialog or simply dismiss.
+     * @param urlCertificateOnError The URL that invokes SSLCertificateError.
+     * Null when fromShowSSLCertificateOnError is false.
      */
     void showPageInfo(final Tab tab,
-            final boolean fromShowSSLCertificateOnError) {
+            final boolean fromShowSSLCertificateOnError,
+            final String urlCertificateOnError) {
         final LayoutInflater factory = LayoutInflater.from(mContext);
 
         final View pageInfoView = factory.inflate(R.layout.page_info, null);
 
         final WebView view = tab.getWebView();
 
-        String url = tab.getUrl();
+        String url = fromShowSSLCertificateOnError ? urlCertificateOnError : tab.getUrl();
         String title = tab.getTitle();
 
         if (url == null) {
@@ -153,6 +160,7 @@
 
         mPageInfoView = tab;
         mPageInfoFromShowSSLCertificateOnError = fromShowSSLCertificateOnError;
+        mUrlCertificateOnError = urlCertificateOnError;
 
         AlertDialog.Builder alertDialogBuilder =
             new AlertDialog.Builder(mContext)
@@ -263,7 +271,7 @@
                                 mSSLCertificateDialog = null;
                                 mSSLCertificateView = null;
 
-                                showPageInfo(tab, false);
+                                showPageInfo(tab, false, null);
                             }
                         })
                 .setOnCancelListener(
@@ -272,7 +280,7 @@
                                 mSSLCertificateDialog = null;
                                 mSSLCertificateView = null;
 
-                                showPageInfo(tab, false);
+                                showPageInfo(tab, false, null);
                             }
                         })
                 .show();
@@ -361,7 +369,8 @@
 
                                 showPageInfo(mController.getTabControl()
                                         .getTabFromView(view),
-                                        true);
+                                        true,
+                                        error.getUrl());
                             }
                         })
                 .setOnCancelListener(