Cleanup tab crash view from browser

Change-Id: Ic382071ef6cfdac1a45e187d331493fe15b0f1b3
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 07f2d12..1138700 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -403,7 +403,6 @@
                 && BrowserActivity.ACTION_SHOW_BOOKMARKS.equals(intent.getAction())) {
             bookmarksOrHistoryPicker(ComboViews.Bookmarks);
         }
-
         mLowPowerReceiver = new PowerConnectionReceiver();
         mPowerChangeReceiver = new PowerConnectionReceiver();
 
@@ -415,7 +414,6 @@
         }
         filter.addAction(Intent.ACTION_BATTERY_OKAY);
         mActivity.registerReceiver(mPowerChangeReceiver, filter);
-
     }
 
     private static class PruneThumbnails implements Runnable {
@@ -457,10 +455,7 @@
 
     @Override
     public void onSetWebView(Tab tab, WebView view) {
-        if (tab.hasCrashed)
-            tab.showCrashView();
-        else
-            mUi.onSetWebView(tab, view);
+        mUi.onSetWebView(tab, view);
     }
 
     @Override
@@ -766,7 +761,6 @@
 
         WebView.disablePlatformNotifications();
         NfcHandler.unregister(mActivity);
-
         mActivity.unregisterReceiver(mLowPowerReceiver);
     }
 
@@ -814,10 +808,8 @@
             mUi.onVoiceResult(mVoiceResult);
             mVoiceResult = null;
         }
-        if (current != null && current.hasCrashed) {
-            current.replaceCrashView(current.getWebView(), current.getViewContainer());
-        }
-
+        if (current != null && current.getWebView().isShowingCrashView())
+            current.getWebView().reload();
         mActivity.registerReceiver(mLowPowerReceiver, new IntentFilter(Intent.ACTION_BATTERY_LOW));
     }
 
@@ -2092,10 +2084,6 @@
                     stopLoading();
                 } else {
                     Tab currentTab = mTabControl.getCurrentTab();
-                    if (currentTab.hasCrashed) {
-                        currentTab.replaceCrashView(getCurrentTopWebView(),
-                            currentTab.getViewContainer());
-                    }
                     getCurrentTopWebView().reload();
                 }
                 break;
@@ -3210,9 +3198,6 @@
             dismissSubWindow(tab);
             mHomepageHandler.registerJsInterface(tab.getWebView(), url);
             tab.loadUrl(url, headers);
-            if (tab.hasCrashed) {
-                tab.replaceCrashView(tab.getWebView(), tab.getViewContainer());
-            }
             mUi.onProgressChanged(tab);
         }
     }
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index a973c93..3226800 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -168,9 +168,6 @@
                 if (web != null) {
                     stopEditingUrl();
                     Tab currentTab = mUiController.getTabControl().getCurrentTab();
-                    if (currentTab.hasCrashed) {
-                        currentTab.replaceCrashView(web, currentTab.getViewContainer());
-                    }
                     web.reload();
                 }
             }
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index 055da98..31edce9 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -230,10 +230,6 @@
         } else {
             if (mUiController.getCurrentTopWebView() != null) {
                 Tab currTab = mUiController.getTabControl().getCurrentTab();
-                if (currTab.hasCrashed) {
-                    currTab.replaceCrashView(mUiController.getCurrentTopWebView(),
-                        currTab.getViewContainer());
-                }
                 mUiController.getCurrentTopWebView().reload();
             }
         }
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index d606b79..e935932 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -461,10 +461,6 @@
             webview = (BrowserWebView)tab.getWebView();
             if (webview == null) {
                 isready = false;
-            }
-            else if (webview.hasCrashed()) {
-                webview.reload();
-                isready = true;
             } else {
                 isready = webview.isReady();
             }
@@ -479,25 +475,22 @@
             return;
         }
         mNumTries = 0;
-        final boolean hasCrashed = (webview == null) ? false : webview.hasCrashed();
+        final boolean hasCrashed = (webview == null) ? false :false;
         // fast path: don't wait if we've been ready for a while
         if (zeroTries) {
-            fadeOutCustomViewContainer(hasCrashed);
+            fadeOutCustomViewContainer();
             return;
         }
         mCustomViewContainer.postDelayed(new Runnable() {
             public void run() {
-                fadeOutCustomViewContainer(hasCrashed);
+                fadeOutCustomViewContainer();
             }
         }, 32); //WebView is ready, but give it extra 2 frame's time to display and finish the swaps
     }
 
-    private void fadeOutCustomViewContainer(boolean hasCrashed) {
+    private void fadeOutCustomViewContainer() {
         ObjectAnimator otheralpha = ObjectAnimator.ofFloat(mCustomViewContainer, "alpha", 1f, 0f);
-        if (hasCrashed)
-            otheralpha.setDuration(300);
-        else
-            otheralpha.setDuration(100);
+        otheralpha.setDuration(100);
         otheralpha.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator anim) {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 7ea2955..cc9ddbd 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -109,7 +109,6 @@
     private static final int INITIAL_PROGRESS = 5;
 
     private static Bitmap sDefaultFavicon;
-    protected boolean hasCrashed = false;
 
     private static Paint sAlphaPaint = new Paint();
     static {
@@ -327,36 +326,6 @@
         }
     }
 
-    protected void replaceCrashView(View view, View container) {
-        if (hasCrashed && (view == mMainView)) {
-            final FrameLayout wrapper = (FrameLayout) container.findViewById(R.id.webview_wrapper);
-            wrapper.removeAllViewsInLayout();
-            wrapper.addView(view);
-            hasCrashed = false;
-        }
-        mMainView.reload();
-    }
-
-    protected void showCrashView() {
-        if (hasCrashed) {
-            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-            final View crashLayout = inflater.inflate(R.layout.browser_tab_crash, null);
-            final FrameLayout wrapper =
-                    (FrameLayout) mContainer.findViewById(R.id.webview_wrapper);
-            wrapper.removeAllViewsInLayout();
-            wrapper.addView(crashLayout);
-            mContainer.requestFocus();
-            Button reloadBtn = (Button) crashLayout.findViewById(R.id.browser_crash_reload_btn);
-            reloadBtn.setOnClickListener(new OnClickListener() {
-                @Override
-                public void onClick(View arg0) {
-                    replaceCrashView(mMainView, mContainer);
-                }
-            });
-        }
-    }
-
     public void setNetworkAvailable(boolean networkUp) {
         if (networkUp && mReceivedError && (mMainView != null)) {
             mMainView.reload();
@@ -660,15 +629,6 @@
             }, null, null, host, port, null);
         }
 
-        @Override
-        public void onRendererCrash(WebView view, boolean crashedWhileOomProtected) {
-            Log.e(LOGTAG, "Tab Crashed");
-            if (mWebViewController.getTabControl().getCurrentTab() == Tab.this) {
-                hasCrashed = true;
-                showCrashView();
-            }
-        }
-
         /**
          * Handles an HTTP authentication request.
          *
@@ -1583,11 +1543,6 @@
 
     void resume() {
         if (mMainView != null) {
-            if (mMainView.hasCrashed()) {
-                // Reload if render process has crashed. This is done here so that
-                // setFocus call sends wasShown message to correct render process.
-                mMainView.setNeedsReload(true);
-            }
             setupHwAcceleration(mMainView);
             mMainView.onResume();
             if (mSubView != null) {
@@ -2037,7 +1992,7 @@
             return;
         }
 
-        if (!mFirstVisualPixelPainted) {
+        if (!mFirstVisualPixelPainted || mMainView.isShowingCrashView()) {
             mCapture = Bitmap.createBitmap(
                     mCaptureWidth,
                     mCaptureHeight,