| OLD | NEW |
| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 void DesktopWindowTreeHostMus::ShowMaximizedWithBounds( | 117 void DesktopWindowTreeHostMus::ShowMaximizedWithBounds( |
| 118 const gfx::Rect& restored_bounds) { | 118 const gfx::Rect& restored_bounds) { |
| 119 window()->SetProperty(aura::client::kRestoreBoundsKey, | 119 window()->SetProperty(aura::client::kRestoreBoundsKey, |
| 120 new gfx::Rect(restored_bounds)); | 120 new gfx::Rect(restored_bounds)); |
| 121 ShowWindowWithState(ui::SHOW_STATE_MAXIMIZED); | 121 ShowWindowWithState(ui::SHOW_STATE_MAXIMIZED); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool DesktopWindowTreeHostMus::IsVisible() const { | 124 bool DesktopWindowTreeHostMus::IsVisible() const { |
| 125 return window()->IsVisible(); | 125 // Go through the DesktopNativeWidgetAura::IsVisible() for checking |
| 126 // visibility of the parent as it has additional checks beyond checking the |
| 127 // aura::Window. |
| 128 return window()->IsVisible() && |
| 129 (!parent_ || |
| 130 static_cast<const internal::NativeWidgetPrivate*>( |
| 131 parent_->desktop_native_widget_aura_) |
| 132 ->IsVisible()); |
| 126 } | 133 } |
| 127 | 134 |
| 128 void DesktopWindowTreeHostMus::SetSize(const gfx::Size& size) { | 135 void DesktopWindowTreeHostMus::SetSize(const gfx::Size& size) { |
| 129 // TODO: handle device scale, http://crbug.com/663524. | 136 // Use GetBounds() as the origin of window() is always at 0, 0. |
| 130 SetBounds(gfx::Rect(window()->bounds().origin(), size)); | 137 gfx::Rect screen_bounds = GetBounds(); |
| 138 // TODO: handle device scale, http://crbug.com/663524. Also, |screen_bounds| |
| 139 // is in pixels and should be dip. |
| 140 screen_bounds.set_size(size); |
| 141 SetBounds(screen_bounds); |
| 131 } | 142 } |
| 132 | 143 |
| 133 void DesktopWindowTreeHostMus::StackAbove(aura::Window* window) { | 144 void DesktopWindowTreeHostMus::StackAbove(aura::Window* window) { |
| 134 // TODO: implement window stacking, http://crbug.com/663617. | 145 // TODO: implement window stacking, http://crbug.com/663617. |
| 135 NOTIMPLEMENTED(); | 146 NOTIMPLEMENTED(); |
| 136 } | 147 } |
| 137 | 148 |
| 138 void DesktopWindowTreeHostMus::StackAtTop() { | 149 void DesktopWindowTreeHostMus::StackAtTop() { |
| 139 // TODO: implement window stacking, http://crbug.com/663617. | 150 // TODO: implement window stacking, http://crbug.com/663617. |
| 140 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (window == this->window()) { | 415 if (window == this->window()) { |
| 405 is_active_ = true; | 416 is_active_ = true; |
| 406 desktop_native_widget_aura_->HandleActivationChanged(true); | 417 desktop_native_widget_aura_->HandleActivationChanged(true); |
| 407 } else if (is_active_) { | 418 } else if (is_active_) { |
| 408 is_active_ = false; | 419 is_active_ = false; |
| 409 desktop_native_widget_aura_->HandleActivationChanged(false); | 420 desktop_native_widget_aura_->HandleActivationChanged(false); |
| 410 } | 421 } |
| 411 } | 422 } |
| 412 | 423 |
| 413 } // namespace views | 424 } // namespace views |
| OLD | NEW |