| 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_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 bool WindowState::IsFullscreen() const { | 133 bool WindowState::IsFullscreen() const { |
| 134 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; | 134 return GetShowState() == ui::SHOW_STATE_FULLSCREEN; |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool WindowState::IsMaximizedOrFullscreen() const { | 137 bool WindowState::IsMaximizedOrFullscreen() const { |
| 138 ui::WindowShowState show_state(GetShowState()); | 138 ui::WindowShowState show_state(GetShowState()); |
| 139 return show_state == ui::SHOW_STATE_FULLSCREEN || | 139 return show_state == ui::SHOW_STATE_FULLSCREEN || |
| 140 show_state == ui::SHOW_STATE_MAXIMIZED; | 140 show_state == ui::SHOW_STATE_MAXIMIZED; |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool WindowState::IsNormalShowState() const { | 143 bool WindowState::IsSnapped() const { |
| 144 ui::WindowShowState state = GetShowState(); | 144 return window_show_type_ == SHOW_TYPE_LEFT_SNAPPED || |
| 145 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 145 window_show_type_ == SHOW_TYPE_RIGHT_SNAPPED; |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool WindowState::IsNormalShowType() const { | 148 bool WindowState::IsNormalShowType() const { |
| 149 return window_show_type_ == SHOW_TYPE_NORMAL || | 149 return window_show_type_ == SHOW_TYPE_NORMAL || |
| 150 window_show_type_ == SHOW_TYPE_DEFAULT; | 150 window_show_type_ == SHOW_TYPE_DEFAULT; |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool WindowState::IsNormalOrSnapped() const { |
| 154 return IsNormalShowType() || IsSnapped(); |
| 155 } |
| 156 |
| 153 bool WindowState::IsActive() const { | 157 bool WindowState::IsActive() const { |
| 154 return IsActiveWindow(window_); | 158 return IsActiveWindow(window_); |
| 155 } | 159 } |
| 156 | 160 |
| 157 bool WindowState::IsDocked() const { | 161 bool WindowState::IsDocked() const { |
| 158 return window_->parent() && | 162 return window_->parent() && |
| 159 window_->parent()->id() == internal::kShellWindowId_DockedContainer; | 163 window_->parent()->id() == internal::kShellWindowId_DockedContainer; |
| 160 } | 164 } |
| 161 | 165 |
| 162 bool WindowState::IsSnapped() const { | |
| 163 return window_show_type_ == SHOW_TYPE_LEFT_SNAPPED || | |
| 164 window_show_type_ == SHOW_TYPE_RIGHT_SNAPPED; | |
| 165 } | |
| 166 | |
| 167 bool WindowState::CanMaximize() const { | 166 bool WindowState::CanMaximize() const { |
| 168 return window_->GetProperty(aura::client::kCanMaximizeKey); | 167 return window_->GetProperty(aura::client::kCanMaximizeKey); |
| 169 } | 168 } |
| 170 | 169 |
| 171 bool WindowState::CanMinimize() const { | 170 bool WindowState::CanMinimize() const { |
| 172 internal::RootWindowController* controller = | 171 internal::RootWindowController* controller = |
| 173 internal::RootWindowController::ForWindow(window_); | 172 internal::RootWindowController::ForWindow(window_); |
| 174 if (!controller) | 173 if (!controller) |
| 175 return false; | 174 return false; |
| 176 aura::Window* lockscreen = controller->GetContainer( | 175 aura::Window* lockscreen = controller->GetContainer( |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } | 463 } |
| 465 return settings; | 464 return settings; |
| 466 } | 465 } |
| 467 | 466 |
| 468 const WindowState* GetWindowState(const aura::Window* window) { | 467 const WindowState* GetWindowState(const aura::Window* window) { |
| 469 return GetWindowState(const_cast<aura::Window*>(window)); | 468 return GetWindowState(const_cast<aura::Window*>(window)); |
| 470 } | 469 } |
| 471 | 470 |
| 472 } // namespace wm | 471 } // namespace wm |
| 473 } // namespace ash | 472 } // namespace ash |
| OLD | NEW |