Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2535753009: Couple of changes for client area (Closed)
Patch Set: nuke todo Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/desktop_window_tree_host_mus.h" 5 #include "ui/views/mus/desktop_window_tree_host_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/drag_drop_client.h" 9 #include "ui/aura/client/drag_drop_client.h"
10 #include "ui/aura/client/focus_client.h" 10 #include "ui/aura/client/focus_client.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 MusClient::Get()->RemoveObserver(this); 128 MusClient::Get()->RemoveObserver(this);
129 aura::Env::GetInstance()->RemoveObserver(this); 129 aura::Env::GetInstance()->RemoveObserver(this);
130 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); 130 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
131 } 131 }
132 132
133 bool DesktopWindowTreeHostMus::IsDocked() const { 133 bool DesktopWindowTreeHostMus::IsDocked() const {
134 return window()->GetProperty(aura::client::kShowStateKey) == 134 return window()->GetProperty(aura::client::kShowStateKey) ==
135 ui::SHOW_STATE_DOCKED; 135 ui::SHOW_STATE_DOCKED;
136 } 136 }
137 137
138 // TODO(erg): In addition to being called on system events, this also needs to
139 // be called after window size changed.
140 void DesktopWindowTreeHostMus::SendClientAreaToServer() { 138 void DesktopWindowTreeHostMus::SendClientAreaToServer() {
141 NonClientView* non_client_view = 139 NonClientView* non_client_view =
142 native_widget_delegate_->AsWidget()->non_client_view(); 140 native_widget_delegate_->AsWidget()->non_client_view();
143 if (!non_client_view || !non_client_view->client_view()) 141 if (!non_client_view || !non_client_view->client_view())
144 return; 142 return;
145 143
146 const gfx::Rect client_area_rect(non_client_view->client_view()->bounds()); 144 const gfx::Rect client_area_rect(non_client_view->client_view()->bounds());
147 SetClientArea(gfx::Insets( 145 SetClientArea(gfx::Insets(
148 client_area_rect.y(), client_area_rect.x(), 146 client_area_rect.y(), client_area_rect.x(),
149 non_client_view->bounds().height() - client_area_rect.bottom(), 147 non_client_view->bounds().height() - client_area_rect.bottom(),
(...skipping 20 matching lines...) Expand all
170 ->GetDisplayNearestWindow(const_cast<aura::Window*>(window())) 168 ->GetDisplayNearestWindow(const_cast<aura::Window*>(window()))
171 .device_scale_factor(); 169 .device_scale_factor();
172 } 170 }
173 171
174 void DesktopWindowTreeHostMus::SetBoundsInDIP(const gfx::Rect& bounds_in_dip) { 172 void DesktopWindowTreeHostMus::SetBoundsInDIP(const gfx::Rect& bounds_in_dip) {
175 SetBoundsInPixels(gfx::ConvertRectToPixel(GetScaleFactor(), bounds_in_dip)); 173 SetBoundsInPixels(gfx::ConvertRectToPixel(GetScaleFactor(), bounds_in_dip));
176 } 174 }
177 175
178 void DesktopWindowTreeHostMus::Init(aura::Window* content_window, 176 void DesktopWindowTreeHostMus::Init(aura::Window* content_window,
179 const Widget::InitParams& params) { 177 const Widget::InitParams& params) {
178 // Needed so we don't render over the non-client area the window manager
179 // renders to.
180 content_window->layer()->SetFillsBoundsOpaquely(false);
180 if (!params.bounds.IsEmpty()) 181 if (!params.bounds.IsEmpty())
181 SetBoundsInDIP(params.bounds); 182 SetBoundsInDIP(params.bounds);
182 } 183 }
183 184
184 void DesktopWindowTreeHostMus::OnNativeWidgetCreated( 185 void DesktopWindowTreeHostMus::OnNativeWidgetCreated(
185 const Widget::InitParams& params) { 186 const Widget::InitParams& params) {
186 if (params.parent && params.parent->GetHost()) { 187 if (params.parent && params.parent->GetHost()) {
187 parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost()); 188 parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost());
188 parent_->children_.insert(this); 189 parent_->children_.insert(this);
189 } 190 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 534 }
534 535
535 void DesktopWindowTreeHostMus::SizeConstraintsChanged() { 536 void DesktopWindowTreeHostMus::SizeConstraintsChanged() {
536 int32_t behavior = ui::mojom::kResizeBehaviorNone; 537 int32_t behavior = ui::mojom::kResizeBehaviorNone;
537 Widget* widget = native_widget_delegate_->AsWidget(); 538 Widget* widget = native_widget_delegate_->AsWidget();
538 if (widget->widget_delegate()) 539 if (widget->widget_delegate())
539 behavior = widget->widget_delegate()->GetResizeBehavior(); 540 behavior = widget->widget_delegate()->GetResizeBehavior();
540 window()->SetProperty(aura::client::kResizeBehaviorKey, behavior); 541 window()->SetProperty(aura::client::kResizeBehaviorKey, behavior);
541 } 542 }
542 543
544 bool DesktopWindowTreeHostMus::ShouldUpdateWindowTransparency() const {
545 // Needed so the window manager can render the client decorations.
546 return false;
547 }
548
543 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() { 549 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() {
544 NonClientView* non_client_view = 550 NonClientView* non_client_view =
545 native_widget_delegate_->AsWidget()->non_client_view(); 551 native_widget_delegate_->AsWidget()->non_client_view();
546 if (non_client_view) { 552 if (non_client_view) {
547 non_client_view->Layout(); 553 non_client_view->Layout();
548 non_client_view->SchedulePaint(); 554 non_client_view->SchedulePaint();
549 } 555 }
550 556
551 SendClientAreaToServer(); 557 SendClientAreaToServer();
552 SendHitTestMaskToServer(); 558 SendHitTestMaskToServer();
(...skipping 19 matching lines...) Expand all
572 if (GetBoundsInPixels().size() != bounds_in_pixels.size()) { 578 if (GetBoundsInPixels().size() != bounds_in_pixels.size()) {
573 gfx::Size size = bounds_in_pixels.size(); 579 gfx::Size size = bounds_in_pixels.size();
574 size.SetToMax(gfx::ConvertSizeToPixel( 580 size.SetToMax(gfx::ConvertSizeToPixel(
575 GetScaleFactor(), native_widget_delegate_->GetMinimumSize())); 581 GetScaleFactor(), native_widget_delegate_->GetMinimumSize()));
576 const gfx::Size max_size_in_pixels = gfx::ConvertSizeToPixel( 582 const gfx::Size max_size_in_pixels = gfx::ConvertSizeToPixel(
577 GetScaleFactor(), native_widget_delegate_->GetMaximumSize()); 583 GetScaleFactor(), native_widget_delegate_->GetMaximumSize());
578 if (!max_size_in_pixels.IsEmpty()) 584 if (!max_size_in_pixels.IsEmpty())
579 size.SetToMin(max_size_in_pixels); 585 size.SetToMin(max_size_in_pixels);
580 final_bounds_in_pixels.set_size(size); 586 final_bounds_in_pixels.set_size(size);
581 } 587 }
588 const gfx::Rect old_bounds_in_pixels = GetBoundsInPixels();
582 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels); 589 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels);
590 if (old_bounds_in_pixels.size() != final_bounds_in_pixels.size()) {
591 SendClientAreaToServer();
592 SendHitTestMaskToServer();
593 }
583 } 594 }
584 595
585 void DesktopWindowTreeHostMus::OnWindowInitialized(aura::Window* window) {} 596 void DesktopWindowTreeHostMus::OnWindowInitialized(aura::Window* window) {}
586 597
587 void DesktopWindowTreeHostMus::OnActiveFocusClientChanged( 598 void DesktopWindowTreeHostMus::OnActiveFocusClientChanged(
588 aura::client::FocusClient* focus_client, 599 aura::client::FocusClient* focus_client,
589 aura::Window* window) { 600 aura::Window* window) {
590 if (window == this->window()) { 601 if (window == this->window()) {
591 is_active_ = true; 602 is_active_ = true;
592 desktop_native_widget_aura_->HandleActivationChanged(true); 603 desktop_native_widget_aura_->HandleActivationChanged(true);
593 } else if (is_active_) { 604 } else if (is_active_) {
594 is_active_ = false; 605 is_active_ = false;
595 desktop_native_widget_aura_->HandleActivationChanged(false); 606 desktop_native_widget_aura_->HandleActivationChanged(false);
596 } 607 }
597 } 608 }
598 609
599 } // namespace views 610 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698