Chromium Code Reviews| 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 // Go through the Widget api for checking visibility as it has additional | |
|
msw
2016/11/10 01:33:56
Hmm, Widget::IsVisible() just returns |native_widg
sky
2016/11/10 05:44:46
Good call. fixed!
| |
| 126 // checks beyond checking the aura::Window. | |
| 127 if (parent_ && !parent_->native_widget_delegate_->AsWidget()->IsVisible()) | |
| 128 return false; | |
| 125 return window()->IsVisible(); | 129 return window()->IsVisible(); |
| 126 } | 130 } |
| 127 | 131 |
| 128 void DesktopWindowTreeHostMus::SetSize(const gfx::Size& size) { | 132 void DesktopWindowTreeHostMus::SetSize(const gfx::Size& size) { |
| 129 // TODO: handle device scale, http://crbug.com/663524. | 133 // Use GetBounds() as the origin of window() is always at 0, 0. |
| 130 SetBounds(gfx::Rect(window()->bounds().origin(), size)); | 134 gfx::Rect screen_bounds = GetBounds(); |
| 135 // TODO: handle device scale, http://crbug.com/663524. Also, |screen_bounds| | |
| 136 // is in pixels and should be dip. | |
| 137 screen_bounds.set_size(size); | |
| 138 SetBounds(screen_bounds); | |
| 131 } | 139 } |
| 132 | 140 |
| 133 void DesktopWindowTreeHostMus::StackAbove(aura::Window* window) { | 141 void DesktopWindowTreeHostMus::StackAbove(aura::Window* window) { |
| 134 // TODO: implement window stacking, http://crbug.com/663617. | 142 // TODO: implement window stacking, http://crbug.com/663617. |
| 135 NOTIMPLEMENTED(); | 143 NOTIMPLEMENTED(); |
| 136 } | 144 } |
| 137 | 145 |
| 138 void DesktopWindowTreeHostMus::StackAtTop() { | 146 void DesktopWindowTreeHostMus::StackAtTop() { |
| 139 // TODO: implement window stacking, http://crbug.com/663617. | 147 // TODO: implement window stacking, http://crbug.com/663617. |
| 140 NOTIMPLEMENTED(); | 148 NOTIMPLEMENTED(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 if (window == this->window()) { | 412 if (window == this->window()) { |
| 405 is_active_ = true; | 413 is_active_ = true; |
| 406 desktop_native_widget_aura_->HandleActivationChanged(true); | 414 desktop_native_widget_aura_->HandleActivationChanged(true); |
| 407 } else if (is_active_) { | 415 } else if (is_active_) { |
| 408 is_active_ = false; | 416 is_active_ = false; |
| 409 desktop_native_widget_aura_->HandleActivationChanged(false); | 417 desktop_native_widget_aura_->HandleActivationChanged(false); |
| 410 } | 418 } |
| 411 } | 419 } |
| 412 | 420 |
| 413 } // namespace views | 421 } // namespace views |
| OLD | NEW |