| 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/common/wm/window_state.h" | 5 #include "ash/common/wm/window_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/wm/default_state.h" | 9 #include "ash/common/wm/default_state.h" |
| 10 #include "ash/common/wm/window_positioning_utils.h" | 10 #include "ash/common/wm/window_positioning_utils.h" |
| 11 #include "ash/common/wm/window_state_delegate.h" | 11 #include "ash/common/wm/window_state_delegate.h" |
| 12 #include "ash/common/wm/window_state_observer.h" | 12 #include "ash/common/wm/window_state_observer.h" |
| 13 #include "ash/common/wm/wm_event.h" | 13 #include "ash/common/wm/wm_event.h" |
| 14 #include "ash/common/wm/wm_screen_util.h" | 14 #include "ash/common/wm/wm_screen_util.h" |
| 15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/common/wm_window_property.h" | |
| 17 #include "base/auto_reset.h" | 16 #include "base/auto_reset.h" |
| 18 | 17 |
| 19 namespace ash { | 18 namespace ash { |
| 20 namespace wm { | 19 namespace wm { |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 WMEventType WMEventTypeFromShowState(ui::WindowShowState requested_show_state) { | 23 WMEventType WMEventTypeFromShowState(ui::WindowShowState requested_show_state) { |
| 25 switch (requested_show_state) { | 24 switch (requested_show_state) { |
| 26 case ui::SHOW_STATE_DEFAULT: | 25 case ui::SHOW_STATE_DEFAULT: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 bool WindowState::IsDocked() const { | 103 bool WindowState::IsDocked() const { |
| 105 return GetStateType() == WINDOW_STATE_TYPE_DOCKED || | 104 return GetStateType() == WINDOW_STATE_TYPE_DOCKED || |
| 106 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; | 105 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; |
| 107 } | 106 } |
| 108 | 107 |
| 109 bool WindowState::IsUserPositionable() const { | 108 bool WindowState::IsUserPositionable() const { |
| 110 return (window_->GetType() == ui::wm::WINDOW_TYPE_NORMAL || | 109 return (window_->GetType() == ui::wm::WINDOW_TYPE_NORMAL || |
| 111 window_->GetType() == ui::wm::WINDOW_TYPE_PANEL); | 110 window_->GetType() == ui::wm::WINDOW_TYPE_PANEL); |
| 112 } | 111 } |
| 113 | 112 |
| 114 bool WindowState::ShouldBeExcludedFromMru() const { | |
| 115 return window_->GetBoolProperty(ash::WmWindowProperty::EXCLUDE_FROM_MRU); | |
| 116 } | |
| 117 | |
| 118 bool WindowState::CanMaximize() const { | 113 bool WindowState::CanMaximize() const { |
| 119 // Window must allow maximization and have no maximum width or height. | 114 // Window must allow maximization and have no maximum width or height. |
| 120 if (!window_->CanMaximize()) | 115 if (!window_->CanMaximize()) |
| 121 return false; | 116 return false; |
| 122 | 117 |
| 123 if (!window_->HasNonClientArea()) | 118 if (!window_->HasNonClientArea()) |
| 124 return true; | 119 return true; |
| 125 | 120 |
| 126 gfx::Size max_size = window_->GetMaximumSize(); | 121 gfx::Size max_size = window_->GetMaximumSize(); |
| 127 return !max_size.width() && !max_size.height(); | 122 return !max_size.width() && !max_size.height(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 154 } |
| 160 | 155 |
| 161 void WindowState::Minimize() { | 156 void WindowState::Minimize() { |
| 162 window_->Minimize(); | 157 window_->Minimize(); |
| 163 } | 158 } |
| 164 | 159 |
| 165 void WindowState::Unminimize() { | 160 void WindowState::Unminimize() { |
| 166 window_->Unminimize(); | 161 window_->Unminimize(); |
| 167 } | 162 } |
| 168 | 163 |
| 169 void WindowState::SetExcludedFromMru(bool excluded_from_mru) { | |
| 170 window_->SetExcludedFromMru(excluded_from_mru); | |
| 171 } | |
| 172 | |
| 173 void WindowState::Activate() { | 164 void WindowState::Activate() { |
| 174 window_->Activate(); | 165 window_->Activate(); |
| 175 } | 166 } |
| 176 | 167 |
| 177 void WindowState::Deactivate() { | 168 void WindowState::Deactivate() { |
| 178 window_->Deactivate(); | 169 window_->Deactivate(); |
| 179 } | 170 } |
| 180 | 171 |
| 181 void WindowState::Restore() { | 172 void WindowState::Restore() { |
| 182 if (!IsNormalStateType()) { | 173 if (!IsNormalStateType()) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 if (!window_->GetTargetVisibility()) { | 386 if (!window_->GetTargetVisibility()) { |
| 396 SetBoundsConstrained(new_bounds); | 387 SetBoundsConstrained(new_bounds); |
| 397 return; | 388 return; |
| 398 } | 389 } |
| 399 | 390 |
| 400 window_->SetBoundsDirectCrossFade(new_bounds); | 391 window_->SetBoundsDirectCrossFade(new_bounds); |
| 401 } | 392 } |
| 402 | 393 |
| 403 } // namespace wm | 394 } // namespace wm |
| 404 } // namespace ash | 395 } // namespace ash |
| OLD | NEW |