| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/window_state.h" | 5 #include "ash/wm/window_state.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/wm/window_properties.h" | 11 #include "ash/wm/window_properties.h" |
| 12 #include "ash/wm/window_state_delegate.h" | 12 #include "ash/wm/window_state_delegate.h" |
| 13 #include "ash/wm/window_state_observer.h" | 13 #include "ash/wm/window_state_observer.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "ash/wm/wm_types.h" | 15 #include "ash/wm/wm_types.h" |
| 16 #include "base/auto_reset.h" | 16 #include "base/auto_reset.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
| 21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
| 22 #include "ui/views/corewm/transient_window_manager.h" |
| 22 #include "ui/views/corewm/window_util.h" | 23 #include "ui/views/corewm/window_util.h" |
| 23 | 24 |
| 24 namespace ash { | 25 namespace ash { |
| 25 namespace wm { | 26 namespace wm { |
| 26 | 27 |
| 27 // static | 28 // static |
| 28 bool WindowState::IsMaximizedOrFullscreenState(ui::WindowShowState show_state) { | 29 bool WindowState::IsMaximizedOrFullscreenState(ui::WindowShowState show_state) { |
| 29 return show_state == ui::SHOW_STATE_FULLSCREEN || | 30 return show_state == ui::SHOW_STATE_FULLSCREEN || |
| 30 show_state == ui::SHOW_STATE_MAXIMIZED; | 31 show_state == ui::SHOW_STATE_MAXIMIZED; |
| 31 } | 32 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return window_->GetProperty(aura::client::kCanResizeKey); | 132 return window_->GetProperty(aura::client::kCanResizeKey); |
| 132 } | 133 } |
| 133 | 134 |
| 134 bool WindowState::CanActivate() const { | 135 bool WindowState::CanActivate() const { |
| 135 return views::corewm::CanActivateWindow(window_); | 136 return views::corewm::CanActivateWindow(window_); |
| 136 } | 137 } |
| 137 | 138 |
| 138 bool WindowState::CanSnap() const { | 139 bool WindowState::CanSnap() const { |
| 139 if (!CanResize() || | 140 if (!CanResize() || |
| 140 window_->type() == aura::client::WINDOW_TYPE_PANEL || | 141 window_->type() == aura::client::WINDOW_TYPE_PANEL || |
| 141 window_->transient_parent()) | 142 views::corewm::GetTransientParent(window_)) |
| 142 return false; | 143 return false; |
| 143 // If a window has a maximum size defined, snapping may make it too big. | 144 // If a window has a maximum size defined, snapping may make it too big. |
| 144 return window_->delegate() ? window_->delegate()->GetMaximumSize().IsEmpty() : | 145 return window_->delegate() ? window_->delegate()->GetMaximumSize().IsEmpty() : |
| 145 true; | 146 true; |
| 146 } | 147 } |
| 147 | 148 |
| 148 bool WindowState::HasRestoreBounds() const { | 149 bool WindowState::HasRestoreBounds() const { |
| 149 return window_->GetProperty(aura::client::kRestoreBoundsKey) != NULL; | 150 return window_->GetProperty(aura::client::kRestoreBoundsKey) != NULL; |
| 150 } | 151 } |
| 151 | 152 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 336 } |
| 336 return settings; | 337 return settings; |
| 337 } | 338 } |
| 338 | 339 |
| 339 const WindowState* GetWindowState(const aura::Window* window) { | 340 const WindowState* GetWindowState(const aura::Window* window) { |
| 340 return GetWindowState(const_cast<aura::Window*>(window)); | 341 return GetWindowState(const_cast<aura::Window*>(window)); |
| 341 } | 342 } |
| 342 | 343 |
| 343 } // namespace wm | 344 } // namespace wm |
| 344 } // namespace ash | 345 } // namespace ash |
| OLD | NEW |