Commit 772a9f20 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Removed use of ViewHierarchyChanged() from NativeAppWindowViews

Having some part of the NativeAppWindowViews' initialization happen
when it is first inserted into a view hierarchy means that the
View is unable to support being re-parented to a different view
hierarchy.

This change allows NativeAppWindowViews to be reparented into a
different hierarchy, giving the class greater flexibility and
allowing for the eventual change to have ClientView be a child of
NonClientFrameView.

Bug: 1083822
Change-Id: I8a5beed53fd24f6b5c3dfd1fe0cb1490427cb9b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207491Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771814}
parent 7539e99a
......@@ -38,6 +38,9 @@ void NativeAppWindowViews::Init(
create_params.GetContentMaximumSize(gfx::Insets()));
Observe(app_window_->web_contents());
web_view_ = AddChildView(std::make_unique<views::WebView>(nullptr));
web_view_->SetWebContents(app_window_->web_contents());
widget_ = new views::Widget;
widget_->AddObserver(this);
InitializeWindow(app_window, create_params);
......@@ -282,15 +285,6 @@ void NativeAppWindowViews::RenderViewHostChanged(
// views::View implementation.
void NativeAppWindowViews::ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) {
if (details.is_add && details.child == this) {
DCHECK(!web_view_);
web_view_ = AddChildView(std::make_unique<views::WebView>(nullptr));
web_view_->SetWebContents(app_window_->web_contents());
}
}
gfx::Size NativeAppWindowViews::GetMinimumSize() const {
return size_constraints_.GetMinimumSize();
}
......
......@@ -116,8 +116,6 @@ class NativeAppWindowViews : public extensions::NativeAppWindow,
content::RenderViewHost* new_host) override;
// views::View:
void ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
......
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