Commit 8583bf4c authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

[fuchsia] Temporarily block popup window creation.

This addresses the current crashing bug that takes place whenever popup windows
are spawned, due to the fact that no WindowParentingClient exists to handle
the newly spawned ui::Window. With this solution, the child windows are
never spawned in the first place.

* Relocated 'content' overrides to FrameImpl's private declarations.
* Misc. IWYU cleanups.

Bug: 888131
Change-Id: I735565047bbe4c8ebab5154a57ad323f33ef8e48
Reviewed-on: https://chromium-review.googlesource.com/1239419
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593402}
parent 5ee5a096
......@@ -103,6 +103,7 @@ FrameImpl::FrameImpl(std::unique_ptr<content::WebContents> web_contents,
focus_controller_(std::make_unique<wm::FocusController>(this)),
context_(context),
binding_(this, std::move(frame_request)) {
web_contents_->SetDelegate(this);
binding_.set_error_handler([this]() { context_->DestroyFrame(this); });
}
......@@ -125,6 +126,29 @@ zx::unowned_channel FrameImpl::GetBindingChannelForTest() const {
return zx::unowned_channel(binding_.channel());
}
bool FrameImpl::ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
DCHECK_EQ(web_contents, web_contents_.get());
// Prevent any child WebContents (popup windows, tabs, etc.) from spawning.
// TODO(crbug.com/888131): Implement support for popup windows.
NOTIMPLEMENTED() << "Ignored popup window request for URL: "
<< target_url.spec();
return false;
}
void FrameImpl::CreateView(
fidl::InterfaceRequest<fuchsia::ui::viewsv1token::ViewOwner> view_owner,
fidl::InterfaceRequest<fuchsia::sys::ServiceProvider> services) {
......
......@@ -8,9 +8,11 @@
#include <lib/fidl/cpp/binding_set.h>
#include <lib/zx/channel.h>
#include <memory>
#include <string>
#include <utility>
#include "base/macros.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/aura/window_tree_host.h"
#include "ui/wm/core/base_focus_rules.h"
......@@ -23,7 +25,6 @@ class WindowTreeHost;
} // namespace aura
namespace content {
class BrowserContext;
class WebContents;
} // namespace content
......@@ -36,6 +37,7 @@ class ContextImpl;
class FrameImpl : public chromium::web::Frame,
public chromium::web::NavigationController,
public content::WebContentsObserver,
public content::WebContentsDelegate,
public wm::BaseFocusRules {
public:
FrameImpl(std::unique_ptr<content::WebContents> web_contents,
......@@ -47,9 +49,6 @@ class FrameImpl : public chromium::web::Frame,
content::WebContents* web_contents_for_test() { return web_contents_.get(); }
// content::WebContentsObserver implementation.
void Init(content::BrowserContext* browser_context, const GURL& url);
// chromium::web::Frame implementation.
void CreateView(
fidl::InterfaceRequest<fuchsia::ui::viewsv1token::ViewOwner> view_owner,
......@@ -70,13 +69,6 @@ class FrameImpl : public chromium::web::Frame,
fidl::InterfaceHandle<chromium::web::NavigationEventObserver> observer)
override;
// content::WebContentsObserver implementation.
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
// wm::BaseFocusRules implementation.
bool SupportsChildActivation(aura::Window*) const override;
private:
FRIEND_TEST_ALL_PREFIXES(ContextImplTest, DelayedNavigationEventAck);
FRIEND_TEST_ALL_PREFIXES(ContextImplTest, NavigationObserverDisconnected);
......@@ -90,6 +82,28 @@ class FrameImpl : public chromium::web::Frame,
// to be reported.
void MaybeSendNavigationEvent();
// content::WebContentsDelegate implementation.
bool ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
// content::WebContentsObserver implementation.
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
// wm::BaseFocusRules implementation.
bool SupportsChildActivation(aura::Window*) const override;
std::unique_ptr<aura::WindowTreeHost> window_tree_host_;
std::unique_ptr<content::WebContents> web_contents_;
std::unique_ptr<wm::FocusController> focus_controller_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment