Revert "Forms: Add a UseCounter for opening popups while a file chooser is opening"

This reverts commit 0b46e1db3d88b762411614d6ae7bbe4f1d5cd6e0.

Reason for revert: Causing multiple layout tests failed based on findit.

Original change's description:
> Forms: Add a UseCounter for opening popups while a file chooser is opening
> 
> We'd like to fix a confusing UI issue, and to know the impact
> of a possible fix.
> 
> Bug: 637639
> Change-Id: I7af67ac314f61723c7904cf0fee408ac2b60e774
> Reviewed-on: https://chromium-review.googlesource.com/1139940
> Commit-Queue: Kent Tamura <tkent@chromium.org>
> Reviewed-by: Keishi Hattori <keishi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#575575}

TBR=keishi@chromium.org,tkent@chromium.org

Change-Id: I4bd3877c33ea7a70a7a7d0d53b7cbb1411240da3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 637639
Reviewed-on: https://chromium-review.googlesource.com/1140393
Reviewed-by: Owen Min <zmin@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575643}
diff --git a/third_party/blink/public/platform/web_feature.mojom b/third_party/blink/public/platform/web_feature.mojom
index a3564c1..fae709f 100644
--- a/third_party/blink/public/platform/web_feature.mojom
+++ b/third_party/blink/public/platform/web_feature.mojom
@@ -1967,7 +1967,6 @@
   kDOMNodeRemovedFromDocumentEventListenedAtNonTarget = 2506,
   kCSSFillAvailableLogicalWidth = 2507,
   kCSSFillAvailableLogicalHeight = 2508,
-  kPopupOpenWhileFileChooserOpened = 2509,
 
   // Add new features immediately above this line. Don't change assigned
   // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/renderer/core/html/forms/file_chooser.cc b/third_party/blink/renderer/core/html/forms/file_chooser.cc
index bfab0af..ebc3146 100644
--- a/third_party/blink/renderer/core/html/forms/file_chooser.cc
+++ b/third_party/blink/renderer/core/html/forms/file_chooser.cc
@@ -41,11 +41,6 @@
   return chooser_.get();
 }
 
-void FileChooserClient::DisconnectFileChooser() {
-  DCHECK(HasConnectedFileChooser());
-  chooser_->DisconnectClient();
-}
-
 inline FileChooser::FileChooser(FileChooserClient* client,
                                 const WebFileChooserParams& params)
     : client_(client), params_(params) {}
diff --git a/third_party/blink/renderer/core/html/forms/file_chooser.h b/third_party/blink/renderer/core/html/forms/file_chooser.h
index 879fcd9..b0d4ce8 100644
--- a/third_party/blink/renderer/core/html/forms/file_chooser.h
+++ b/third_party/blink/renderer/core/html/forms/file_chooser.h
@@ -67,10 +67,6 @@
 
  protected:
   FileChooser* NewFileChooser(const WebFileChooserParams&);
-  bool HasConnectedFileChooser() const { return chooser_.get(); }
-
-  // This should be called if a user chose files or cancel the dialog.
-  void DisconnectFileChooser();
 
  private:
   scoped_refptr<FileChooser> chooser_;
diff --git a/third_party/blink/renderer/core/html/forms/file_input_type.cc b/third_party/blink/renderer/core/html/forms/file_input_type.cc
index eb2f443..5ce73e4 100644
--- a/third_party/blink/renderer/core/html/forms/file_input_type.cc
+++ b/third_party/blink/renderer/core/html/forms/file_input_type.cc
@@ -171,7 +171,6 @@
                       : WebFeature::kInputTypeFileInsecureOriginOpenChooser);
 
     chrome_client->OpenFileChooser(document.GetFrame(), NewFileChooser(params));
-    chrome_client->RegisterPopupOpeningObserver(this);
   }
   event->SetDefaultHandled();
 }
@@ -349,11 +348,6 @@
 void FileInputType::FilesChosen(const Vector<FileChooserFileInfo>& files) {
   SetFiles(CreateFileList(files,
                           GetElement().FastHasAttribute(webkitdirectoryAttr)));
-  if (HasConnectedFileChooser()) {
-    DisconnectFileChooser();
-    if (auto* chrome_client = GetChromeClient())
-      chrome_client->UnregisterPopupOpeningObserver(this);
-  }
 }
 
 void FileInputType::SetFilesFromDirectory(const String& path) {
@@ -460,12 +454,4 @@
   KeyboardClickableInputTypeView::HandleKeyupEvent(event);
 }
 
-void FileInputType::WillOpenPopup() {
-  // TODO(tkent): Should we disconnect the file chooser? crbug.com/637639
-  if (HasConnectedFileChooser()) {
-    UseCounter::Count(GetElement().GetDocument(),
-                      WebFeature::kPopupOpenWhileFileChooserOpened);
-  }
-}
-
 }  // namespace blink
diff --git a/third_party/blink/renderer/core/html/forms/file_input_type.h b/third_party/blink/renderer/core/html/forms/file_input_type.h
index 4227f17..25aa374 100644
--- a/third_party/blink/renderer/core/html/forms/file_input_type.h
+++ b/third_party/blink/renderer/core/html/forms/file_input_type.h
@@ -37,7 +37,6 @@
 #include "third_party/blink/renderer/core/html/forms/file_chooser.h"
 #include "third_party/blink/renderer/core/html/forms/input_type.h"
 #include "third_party/blink/renderer/core/html/forms/keyboard_clickable_input_type_view.h"
-#include "third_party/blink/renderer/core/page/popup_opening_observer.h"
 #include "third_party/blink/renderer/platform/heap/handle.h"
 
 namespace blink {
@@ -47,8 +46,7 @@
 
 class CORE_EXPORT FileInputType final : public InputType,
                                         public KeyboardClickableInputTypeView,
-                                        private FileChooserClient,
-                                        private PopupOpeningObserver {
+                                        private FileChooserClient {
   USING_GARBAGE_COLLECTED_MIXIN(FileInputType);
 
  public:
@@ -100,9 +98,6 @@
   // FileChooserClient implementation.
   void FilesChosen(const Vector<FileChooserFileInfo>&) override;
 
-  // PopupOpeningObserver implementation.
-  void WillOpenPopup() override;
-
   void SetFilesFromDirectory(const String&);
 
   Member<FileList> file_list_;
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc
index ee3858dd..e8dffb2 100644
--- a/third_party/blink/renderer/core/page/chrome_client_impl.cc
+++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -266,7 +266,6 @@
   if (!frame->GetPage() || frame->GetPage()->Paused())
     return nullptr;
 
-  NotifyPopupOpeningObservers();
   const AtomicString& frame_name =
       !EqualIgnoringASCIICase(r.FrameName(), "_blank") ? r.FrameName()
                                                        : g_empty_atom;
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 7432f40..27221c5 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -19352,7 +19352,6 @@
   <int value="2506" label="DOMNodeRemovedFromDocumentEventListenedAtNonTarget"/>
   <int value="2507" label="CSSFillAvailableLogicalWidth"/>
   <int value="2508" label="CSSFillAvailableLogicalHeight"/>
-  <int value="2509" label="PopupOpenWhileFileChooserOpened"/>
 </enum>
 
 <enum name="FeedbackSource">