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

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

Issue 2538633002: Adds a couple more properties to the property converter (Closed)
Patch Set: cleanup 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // TODO: use display id and bounds if available, likely need to pass in 123 // TODO: use display id and bounds if available, likely need to pass in
124 // InitParams for that. 124 // InitParams for that.
125 } 125 }
126 126
127 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() { 127 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() {
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 // static
134 int DesktopWindowTreeHostMus::GetResizeBehaviorFromDelegate(
135 WidgetDelegate* delegate) {
136 if (!delegate)
137 return ui::mojom::kResizeBehaviorNone;
138
139 int32_t behavior = ui::mojom::kResizeBehaviorNone;
140 if (delegate->CanResize())
141 behavior |= ui::mojom::kResizeBehaviorCanResize;
142 if (delegate->CanMaximize())
143 behavior |= ui::mojom::kResizeBehaviorCanMaximize;
144 if (delegate->CanMinimize())
145 behavior |= ui::mojom::kResizeBehaviorCanMinimize;
146 return behavior;
147 }
148
133 bool DesktopWindowTreeHostMus::IsDocked() const { 149 bool DesktopWindowTreeHostMus::IsDocked() const {
134 return window()->GetProperty(aura::client::kShowStateKey) == 150 return window()->GetProperty(aura::client::kShowStateKey) ==
135 ui::SHOW_STATE_DOCKED; 151 ui::SHOW_STATE_DOCKED;
136 } 152 }
137 153
138 // TODO(erg): In addition to being called on system events, this also needs to 154 // TODO(erg): In addition to being called on system events, this also needs to
139 // be called after window size changed. 155 // be called after window size changed.
140 void DesktopWindowTreeHostMus::SendClientAreaToServer() { 156 void DesktopWindowTreeHostMus::SendClientAreaToServer() {
141 NonClientView* non_client_view = 157 NonClientView* non_client_view =
142 native_widget_delegate_->AsWidget()->non_client_view(); 158 native_widget_delegate_->AsWidget()->non_client_view();
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 550 }
535 551
536 void DesktopWindowTreeHostMus::SizeConstraintsChanged() { 552 void DesktopWindowTreeHostMus::SizeConstraintsChanged() {
537 Widget* widget = native_widget_delegate_->AsWidget(); 553 Widget* widget = native_widget_delegate_->AsWidget();
538 window()->SetProperty(aura::client::kCanMaximizeKey, 554 window()->SetProperty(aura::client::kCanMaximizeKey,
539 widget->widget_delegate()->CanMaximize()); 555 widget->widget_delegate()->CanMaximize());
540 window()->SetProperty(aura::client::kCanMinimizeKey, 556 window()->SetProperty(aura::client::kCanMinimizeKey,
541 widget->widget_delegate()->CanMinimize()); 557 widget->widget_delegate()->CanMinimize());
542 window()->SetProperty(aura::client::kCanResizeKey, 558 window()->SetProperty(aura::client::kCanResizeKey,
543 widget->widget_delegate()->CanResize()); 559 widget->widget_delegate()->CanResize());
560 // TODO: replace above keys with kResizeBehaviorKey. http://crbug.com/669290.
msw 2016/11/29 01:15:45 Neat, I was gonna ask about this; I'll take this b
sky 2016/11/29 04:19:36 Thanks!
561 window()->SetProperty(
562 aura::client::kResizeBehaviorKey,
563 GetResizeBehaviorFromDelegate(widget->widget_delegate()));
544 } 564 }
545 565
546 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() { 566 void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() {
547 NonClientView* non_client_view = 567 NonClientView* non_client_view =
548 native_widget_delegate_->AsWidget()->non_client_view(); 568 native_widget_delegate_->AsWidget()->non_client_view();
549 if (non_client_view) { 569 if (non_client_view) {
550 non_client_view->Layout(); 570 non_client_view->Layout();
551 non_client_view->SchedulePaint(); 571 non_client_view->SchedulePaint();
552 } 572 }
553 573
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 if (window == this->window()) { 612 if (window == this->window()) {
593 is_active_ = true; 613 is_active_ = true;
594 desktop_native_widget_aura_->HandleActivationChanged(true); 614 desktop_native_widget_aura_->HandleActivationChanged(true);
595 } else if (is_active_) { 615 } else if (is_active_) {
596 is_active_ = false; 616 is_active_ = false;
597 desktop_native_widget_aura_->HandleActivationChanged(false); 617 desktop_native_widget_aura_->HandleActivationChanged(false);
598 } 618 }
599 } 619 }
600 620
601 } // namespace views 621 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698