Use ActionMode for Find-on-page and Copy.

Bug: 2641352
Change-Id: Ib5c0dd5997457a8d7b9a5c3e5a3727acc6a2f367
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index b45b8cb..9abf32f 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1060,7 +1060,7 @@
 
         @Override
         public void onSelectionDone(WebView view) {
-            if (mInForeground) mActivity.closeDialogs();
+            if (mInForeground) mActivity.endActionMode();
         }
 
         @Override
@@ -1261,7 +1261,7 @@
             // Unlike the others, do not call mClient's version, which would
             // change the progress bar.  However, we do want to remove the
             // find or select dialog.
-            mBrowserActivity.closeDialogs();
+            mBrowserActivity.endActionMode();
         }
         @Override
         public void doUpdateVisitedHistory(WebView view, String url,
@@ -1462,7 +1462,7 @@
      */
     boolean createSubWindow() {
         if (mSubView == null) {
-            mActivity.closeDialogs();
+            mActivity.endActionMode();
             mSubViewContainer = mInflateService.inflate(
                     R.layout.browser_subwindow, null);
             mSubView = (WebView) mSubViewContainer.findViewById(R.id.webview);
@@ -1510,7 +1510,7 @@
      */
     void dismissSubWindow() {
         if (mSubView != null) {
-            mActivity.closeDialogs();
+            mActivity.endActionMode();
             BrowserSettings.getInstance().deleteObserver(
                     mSubView.getSettings());
             mSubView.destroy();
@@ -1535,7 +1535,7 @@
     void removeSubWindow(ViewGroup content) {
         if (mSubView != null) {
             content.removeView(mSubViewContainer);
-            mActivity.closeDialogs();
+            mActivity.endActionMode();
         }
     }
 
@@ -1594,7 +1594,7 @@
                 (FrameLayout) mContainer.findViewById(R.id.webview_wrapper);
         wrapper.removeView(mMainView);
         content.removeView(mContainer);
-        mActivity.closeDialogs();
+        mActivity.endActionMode();
         removeSubWindow(content);
     }
 
@@ -1980,38 +1980,6 @@
         return true;
     }
 
-    /*
-     * Opens the find and select text dialogs.  Called by BrowserActivity.
-     */
-    WebView showDialog(WebDialog dialog) {
-        LinearLayout container;
-        WebView view;
-        if (mSubView != null) {
-            view = mSubView;
-            container = (LinearLayout) mSubViewContainer.findViewById(
-                    R.id.inner_container);
-        } else {
-            view = mMainView;
-            container = mContainer;
-        }
-        dialog.show();
-        container.addView(dialog, 0, new LinearLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT));
-        dialog.setWebView(view);
-        return view;
-    }
-
-    /*
-     * Close the find or select dialog. Called by BrowserActivity.closeDialog.
-     */
-    void closeDialog(WebDialog dialog) {
-        // The dialog may be attached to the subwindow.  Ensure that the
-        // correct parent has it removed.
-        LinearLayout parent = (LinearLayout) dialog.getParent();
-        if (parent != null) parent.removeView(dialog);
-    }
-
     /**
      * always get the TabChangeListener form the tab control
      * @return the TabControl change listener