| Index: ui/views/mus/desktop_window_tree_host_mus.cc
|
| diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc
|
| index 7df2a1550603fc6b7a0de85fa15aeca86ea33ea1..4aaa3faa707ee28f397cb4d65800df6bf1aa5111 100644
|
| --- a/ui/views/mus/desktop_window_tree_host_mus.cc
|
| +++ b/ui/views/mus/desktop_window_tree_host_mus.cc
|
| @@ -33,11 +33,13 @@ DesktopWindowTreeHostMus::DesktopWindowTreeHostMus(
|
| fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT),
|
| close_widget_factory_(this) {
|
| aura::Env::GetInstance()->AddObserver(this);
|
| + MusClient::Get()->AddObserver(this);
|
| // TODO: use display id and bounds if available, likely need to pass in
|
| // InitParams for that.
|
| }
|
|
|
| DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() {
|
| + MusClient::Get()->RemoveObserver(this);
|
| aura::Env::GetInstance()->RemoveObserver(this);
|
| desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
|
| }
|
| @@ -47,6 +49,34 @@ bool DesktopWindowTreeHostMus::IsDocked() const {
|
| ui::SHOW_STATE_DOCKED;
|
| }
|
|
|
| +// TODO(erg): This needs to be called after window size changed.
|
| +void DesktopWindowTreeHostMus::UpdateClientArea() {
|
| + NonClientView* non_client_view =
|
| + native_widget_delegate_->AsWidget()->non_client_view();
|
| + if (!non_client_view || !non_client_view->client_view())
|
| + return;
|
| +
|
| + const gfx::Rect client_area_rect(non_client_view->client_view()->bounds());
|
| + SetClientArea(gfx::Insets(
|
| + client_area_rect.y(), client_area_rect.x(),
|
| + non_client_view->bounds().height() - client_area_rect.bottom(),
|
| + non_client_view->bounds().width() - client_area_rect.right()));
|
| +}
|
| +
|
| +void DesktopWindowTreeHostMus::UpdateHitTestMask() {
|
| + if (!native_widget_delegate_->HasHitTestMask()) {
|
| + ClearHitTestMask();
|
| + return;
|
| + }
|
| +
|
| + gfx::Path mask_path;
|
| + native_widget_delegate_->GetHitTestMask(&mask_path);
|
| + // TODO(jamescook): Use the full path for the mask.
|
| + gfx::Rect mask_rect =
|
| + gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
|
| + SetHitTestMask(mask_rect);
|
| +}
|
| +
|
| void DesktopWindowTreeHostMus::Init(aura::Window* content_window,
|
| const Widget::InitParams& params) {
|
| // TODO: handle device scale, http://crbug.com/663524.
|
| @@ -418,6 +448,18 @@ void DesktopWindowTreeHostMus::SizeConstraintsChanged() {
|
| widget->widget_delegate()->CanResize());
|
| }
|
|
|
| +void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() {
|
| + NonClientView* non_client_view =
|
| + native_widget_delegate_->AsWidget()->non_client_view();
|
| + if (non_client_view) {
|
| + non_client_view->Layout();
|
| + non_client_view->SchedulePaint();
|
| + }
|
| +
|
| + UpdateClientArea();
|
| + UpdateHitTestMask();
|
| +}
|
| +
|
| void DesktopWindowTreeHostMus::ShowImpl() {
|
| native_widget_delegate_->OnNativeWidgetVisibilityChanging(true);
|
| // Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11.
|
|
|