Chromium Code Reviews| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 window_state->window()->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 157 window_state->window()->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 158 } | 158 } |
| 159 | 159 |
| 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 // Do not change the PINNED window state if this is not unpin event. | |
| 168 if (window_state->IsTrustedPinned() && event->type() != WM_EVENT_NORMAL) | |
| 169 return; | |
|
oshima
2016/12/21 21:18:23
move this after workspace events because you still
hidehiko
2016/12/22 16:57:57
Done. Added test in ash/wm/window_state_unittest.c
| |
| 170 | |
| 167 if (ProcessWorkspaceEvents(window_state, event)) | 171 if (ProcessWorkspaceEvents(window_state, event)) |
| 168 return; | 172 return; |
| 169 | 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: |
| (...skipping 591 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 |