chore: stop using a RenderWidgetHost observer in FileSelectHelper (#38168)

chore: stop using a RenderWidgetHost observer in FileSelectHelper
This commit is contained in:
Shelley Vohr 2023-05-04 21:43:29 +02:00 committed by GitHub
parent ec75172d68
commit f8d534f33e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 22 deletions

View file

@ -29,8 +29,6 @@
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "net/base/filename_util.h"
#include "net/base/mime_util.h"
@ -46,8 +44,6 @@ using blink::mojom::FileChooserFileInfoPtr;
using blink::mojom::FileChooserParams;
using blink::mojom::FileChooserParamsPtr;
using content::BrowserThread;
using content::RenderViewHost;
using content::RenderWidgetHost;
using content::WebContents;
namespace {
@ -377,9 +373,7 @@ void FileSelectHelper::RunFileChooser(
render_frame_host_ = render_frame_host;
web_contents_ = WebContents::FromRenderFrameHost(render_frame_host);
listener_ = std::move(listener);
observation_.Reset();
content::WebContentsObserver::Observe(web_contents_);
observation_.Observe(render_frame_host_->GetRenderViewHost()->GetWidget());
base::ThreadPool::PostTask(
FROM_HERE, {base::MayBlock()},
@ -518,13 +512,6 @@ void FileSelectHelper::EnumerateDirectoryEnd() {
Release();
}
void FileSelectHelper::RenderWidgetHostDestroyed(
content::RenderWidgetHost* widget_host) {
render_frame_host_ = nullptr;
DCHECK(observation_.IsObservingSource(widget_host));
observation_.Reset();
}
void FileSelectHelper::RenderFrameHostChanged(
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {