Commit 1c88ca85 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

[exo] Register CustomFrameView as a WindowObserver.

Bug: 866370
Test: PIP window no longer has top portion cut off
Change-Id: I6a4415162fd2697b49866bbe8698d306315fe074
Reviewed-on: https://chromium-review.googlesource.com/1146524
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577462}
parent 1269fbd8
......@@ -120,6 +120,8 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView,
SkColor GetActiveFrameColorForTest() const;
SkColor GetInactiveFrameColorForTest() const;
views::Widget* frame() { return frame_; }
protected:
// Called when overview mode or split view state changed. If overview mode and
// split view mode are both active at the same time, the header of the window
......
......@@ -112,9 +112,16 @@ class CustomFrameView : public ash::CustomFrameViewAsh,
SetVisible(enabled);
if (!enabled)
CustomFrameViewAsh::SetShouldPaintHeader(false);
frame()->GetNativeWindow()->AddObserver(this);
}
~CustomFrameView() override {}
~CustomFrameView() override {
if (frame() && frame()->GetNativeWindow() &&
frame()->GetNativeWindow()->HasObserver(this)) {
frame()->GetNativeWindow()->RemoveObserver(this);
}
}
// Overridden from ash::CustomFrameViewAsh:
void SetShouldPaintHeader(bool paint) override {
......@@ -156,9 +163,15 @@ class CustomFrameView : public ash::CustomFrameViewAsh,
// the window mask layer bounds can be set correctly in function
// SetShouldPaintHeader(). Note: this can be removed if the layer mask in
// CustomFrameView becomes unnecessary.
// TODO(oshima): Investigate if we can eliminate this.
CustomFrameViewAsh::UpdateHeaderView();
}
void OnWindowDestroying(aura::Window* window) override {
DCHECK_EQ(frame()->GetNativeWindow(), window);
window->RemoveObserver(this);
}
// Overridden from views::NonClientFrameView:
gfx::Rect GetBoundsForClientView() const override {
if (visible())
......
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