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

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

Issue 2535753009: Couple of changes for client area (Closed)
Patch Set: order 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 138 // TODO(erg): In addition to being called on system events, this also needs to
139 // be called after window size changed. 139 // be called after window size changed.
Elliot Glaysher 2016/12/01 19:21:24 I believe you can kill this todo now.
sky 2016/12/01 19:23:58 Done.
140 void DesktopWindowTreeHostMus::SendClientAreaToServer() { 140 void DesktopWindowTreeHostMus::SendClientAreaToServer() {
141 NonClientView* non_client_view = 141 NonClientView* non_client_view =
142 native_widget_delegate_->AsWidget()->non_client_view(); 142 native_widget_delegate_->AsWidget()->non_client_view();
143 if (!non_client_view || !non_client_view->client_view()) 143 if (!non_client_view || !non_client_view->client_view())
144 return; 144 return;
145 145
146 const gfx::Rect client_area_rect(non_client_view->client_view()->bounds()); 146 const gfx::Rect client_area_rect(non_client_view->client_view()->bounds());
147 SetClientArea(gfx::Insets( 147 SetClientArea(gfx::Insets(
148 client_area_rect.y(), client_area_rect.x(), 148 client_area_rect.y(), client_area_rect.x(),
149 non_client_view->bounds().height() - client_area_rect.bottom(), 149 non_client_view->bounds().height() - client_area_rect.bottom(),
(...skipping 20 matching lines...) Expand all
170 ->GetDisplayNearestWindow(const_cast<aura::Window*>(window())) 170 ->GetDisplayNearestWindow(const_cast<aura::Window*>(window()))
171 .device_scale_factor(); 171 .device_scale_factor();
172 } 172 }
173 173
174 void DesktopWindowTreeHostMus::SetBoundsInDIP(const gfx::Rect& bounds_in_dip) { 174 void DesktopWindowTreeHostMus::SetBoundsInDIP(const gfx::Rect& bounds_in_dip) {
175 SetBoundsInPixels(gfx::ConvertRectToPixel(GetScaleFactor(), bounds_in_dip)); 175 SetBoundsInPixels(gfx::ConvertRectToPixel(GetScaleFactor(), bounds_in_dip));
176 } 176 }
177 177
178 void DesktopWindowTreeHostMus::Init(aura::Window* content_window, 178 void DesktopWindowTreeHostMus::Init(aura::Window* content_window,
179 const Widget::InitParams& params) { 179 const Widget::InitParams& params) {
180 // Needed so we don't render over the non-client area the window manager
181 // renders to.
182 content_window->layer()->SetFillsBoundsOpaquely(false);
180 if (!params.bounds.IsEmpty()) 183 if (!params.bounds.IsEmpty())
181 SetBoundsInDIP(params.bounds); 184 SetBoundsInDIP(params.bounds);
182 } 185 }
183 186
184 void DesktopWindowTreeHostMus::OnNativeWidgetCreated( 187 void DesktopWindowTreeHostMus::OnNativeWidgetCreated(
185 const Widget::InitParams& params) { 188 const Widget::InitParams& params) {
186 if (params.parent && params.parent->GetHost()) { 189 if (params.parent && params.parent->GetHost()) {
187 parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost()); 190 parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost());
188 parent_->children_.insert(this); 191 parent_->children_.insert(this);
189 } 192 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 536 }
534 537
535 void DesktopWindowTreeHostMus::SizeConstraintsChanged() { 538 void DesktopWindowTreeHostMus::SizeConstraintsChanged() {
536 int32_t behavior = ui::mojom::kResizeBehaviorNone; 539 int32_t behavior = ui::mojom::kResizeBehaviorNone;
537 Widget* widget = native_widget_delegate_->AsWidget(); 540 Widget* widget = native_widget_delegate_->AsWidget();
538 if (widget->widget_delegate()) 541 if (widget->widget_delegate())
539 behavior = widget->widget_delegate()->GetResizeBehavior(); 542 behavior = widget->widget_delegate()->GetResizeBehavior();
540 window()->SetProperty(aura::client::kResizeBehaviorKey, behavior); 543 window()->SetProperty(aura::client::kResizeBehaviorKey, behavior);
541 } 544 }
542 545
546 bool DesktopWindowTreeHostMus::ShouldUpdateWindowTransparency() const {
547 // Needed so the window manager can render the client decorations.
548 return false;
549 }
550
543 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() { 551 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() {
544 NonClientView* non_client_view = 552 NonClientView* non_client_view =
545 native_widget_delegate_->AsWidget()->non_client_view(); 553 native_widget_delegate_->AsWidget()->non_client_view();
546 if (non_client_view) { 554 if (non_client_view) {
547 non_client_view->Layout(); 555 non_client_view->Layout();
548 non_client_view->SchedulePaint(); 556 non_client_view->SchedulePaint();
549 } 557 }
550 558
551 SendClientAreaToServer(); 559 SendClientAreaToServer();
552 SendHitTestMaskToServer(); 560 SendHitTestMaskToServer();
(...skipping 19 matching lines...) Expand all
572 if (GetBoundsInPixels().size() != bounds_in_pixels.size()) { 580 if (GetBoundsInPixels().size() != bounds_in_pixels.size()) {
573 gfx::Size size = bounds_in_pixels.size(); 581 gfx::Size size = bounds_in_pixels.size();
574 size.SetToMax(gfx::ConvertSizeToPixel( 582 size.SetToMax(gfx::ConvertSizeToPixel(
575 GetScaleFactor(), native_widget_delegate_->GetMinimumSize())); 583 GetScaleFactor(), native_widget_delegate_->GetMinimumSize()));
576 const gfx::Size max_size_in_pixels = gfx::ConvertSizeToPixel( 584 const gfx::Size max_size_in_pixels = gfx::ConvertSizeToPixel(
577 GetScaleFactor(), native_widget_delegate_->GetMaximumSize()); 585 GetScaleFactor(), native_widget_delegate_->GetMaximumSize());
578 if (!max_size_in_pixels.IsEmpty()) 586 if (!max_size_in_pixels.IsEmpty())
579 size.SetToMin(max_size_in_pixels); 587 size.SetToMin(max_size_in_pixels);
580 final_bounds_in_pixels.set_size(size); 588 final_bounds_in_pixels.set_size(size);
581 } 589 }
590 const gfx::Rect old_bounds_in_pixels = GetBoundsInPixels();
582 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels); 591 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels);
592 if (old_bounds_in_pixels.size() != final_bounds_in_pixels.size()) {
593 SendClientAreaToServer();
594 SendHitTestMaskToServer();
595 }
583 } 596 }
584 597
585 void DesktopWindowTreeHostMus::OnWindowInitialized(aura::Window* window) {} 598 void DesktopWindowTreeHostMus::OnWindowInitialized(aura::Window* window) {}
586 599
587 void DesktopWindowTreeHostMus::OnActiveFocusClientChanged( 600 void DesktopWindowTreeHostMus::OnActiveFocusClientChanged(
588 aura::client::FocusClient* focus_client, 601 aura::client::FocusClient* focus_client,
589 aura::Window* window) { 602 aura::Window* window) {
590 if (window == this->window()) { 603 if (window == this->window()) {
591 is_active_ = true; 604 is_active_ = true;
592 desktop_native_widget_aura_->HandleActivationChanged(true); 605 desktop_native_widget_aura_->HandleActivationChanged(true);
593 } else if (is_active_) { 606 } else if (is_active_) {
594 is_active_ = false; 607 is_active_ = false;
595 desktop_native_widget_aura_->HandleActivationChanged(false); 608 desktop_native_widget_aura_->HandleActivationChanged(false);
596 } 609 }
597 } 610 }
598 611
599 } // namespace views 612 } // 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