OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/default_state.h" | 5 #include "ash/common/wm/default_state.h" |
6 | 6 |
7 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 7 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
8 #include "ash/common/wm/window_animation_types.h" | 8 #include "ash/common/wm/window_animation_types.h" |
9 #include "ash/common/wm/window_parenting_utils.h" | 9 #include "ash/common/wm/window_parenting_utils.h" |
10 #include "ash/common/wm/window_positioning_utils.h" | 10 #include "ash/common/wm/window_positioning_utils.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } // namespace | 160 } // namespace |
161 | 161 |
162 DefaultState::DefaultState(WindowStateType initial_state_type) | 162 DefaultState::DefaultState(WindowStateType initial_state_type) |
163 : state_type_(initial_state_type), stored_window_state_(nullptr) {} | 163 : state_type_(initial_state_type), stored_window_state_(nullptr) {} |
164 DefaultState::~DefaultState() {} | 164 DefaultState::~DefaultState() {} |
165 | 165 |
166 void DefaultState::OnWMEvent(WindowState* window_state, const WMEvent* event) { | 166 void DefaultState::OnWMEvent(WindowState* window_state, const WMEvent* event) { |
167 if (ProcessWorkspaceEvents(window_state, event)) | 167 if (ProcessWorkspaceEvents(window_state, event)) |
168 return; | 168 return; |
169 | 169 |
| 170 // Do not change the PINNED window state if this is not unpin event. |
| 171 if (window_state->IsTrustedPinned() && event->type() != WM_EVENT_NORMAL) |
| 172 return; |
| 173 |
170 if (ProcessCompoundEvents(window_state, event)) | 174 if (ProcessCompoundEvents(window_state, event)) |
171 return; | 175 return; |
172 | 176 |
173 WindowStateType current_state_type = window_state->GetStateType(); | 177 WindowStateType current_state_type = window_state->GetStateType(); |
174 WindowStateType next_state_type = WINDOW_STATE_TYPE_NORMAL; | 178 WindowStateType next_state_type = WINDOW_STATE_TYPE_NORMAL; |
175 switch (event->type()) { | 179 switch (event->type()) { |
176 case WM_EVENT_NORMAL: | 180 case WM_EVENT_NORMAL: |
177 next_state_type = current_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED | 181 next_state_type = current_state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED |
178 ? WINDOW_STATE_TYPE_DOCKED | 182 ? WINDOW_STATE_TYPE_DOCKED |
179 : WINDOW_STATE_TYPE_NORMAL; | 183 : WINDOW_STATE_TYPE_NORMAL; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 772 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); |
769 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 773 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
770 window_state->SetBoundsDirectAnimated(center_in_parent); | 774 window_state->SetBoundsDirectAnimated(center_in_parent); |
771 } | 775 } |
772 // Centering window is treated as if a user moved and resized the window. | 776 // Centering window is treated as if a user moved and resized the window. |
773 window_state->set_bounds_changed_by_user(true); | 777 window_state->set_bounds_changed_by_user(true); |
774 } | 778 } |
775 | 779 |
776 } // namespace wm | 780 } // namespace wm |
777 } // namespace ash | 781 } // namespace ash |
OLD | NEW |