| 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/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 8 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 9 #include "ash/common/wm/window_animation_types.h" | 9 #include "ash/common/wm/window_animation_types.h" |
| 10 #include "ash/common/wm/window_parenting_utils.h" | 10 #include "ash/common/wm/window_parenting_utils.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 case WM_EVENT_DOCK: | 198 case WM_EVENT_DOCK: |
| 199 next_state_type = WINDOW_STATE_TYPE_DOCKED; | 199 next_state_type = WINDOW_STATE_TYPE_DOCKED; |
| 200 break; | 200 break; |
| 201 case WM_EVENT_SET_BOUNDS: | 201 case WM_EVENT_SET_BOUNDS: |
| 202 SetBounds(window_state, static_cast<const SetBoundsEvent*>(event)); | 202 SetBounds(window_state, static_cast<const SetBoundsEvent*>(event)); |
| 203 return; | 203 return; |
| 204 case WM_EVENT_SHOW_INACTIVE: | 204 case WM_EVENT_SHOW_INACTIVE: |
| 205 next_state_type = WINDOW_STATE_TYPE_INACTIVE; | 205 next_state_type = WINDOW_STATE_TYPE_INACTIVE; |
| 206 break; | 206 break; |
| 207 case WM_EVENT_PIN: | 207 case WM_EVENT_PIN: |
| 208 // TODO(hidehiko): Check if the window can be pinnable. If a system modal | 208 // If there already is a pinned window, it is not allowed to set it |
| 209 // window is openening, or if there already is another pinned window, | 209 // to this window. |
| 210 // the pinning should fail. | 210 // TODO(hidehiko): If a system modal window is openening, the pinning |
| 211 next_state_type = WINDOW_STATE_TYPE_PINNED; | 211 // probably should fail. |
| 212 if (WmShell::Get()->IsPinned()) { |
| 213 LOG(ERROR) << "An PIN event is triggered, while another window is " |
| 214 << "already in pinned mode."; |
| 215 next_state_type = current_state_type; |
| 216 } else { |
| 217 next_state_type = WINDOW_STATE_TYPE_PINNED; |
| 218 } |
| 212 break; | 219 break; |
| 213 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: | 220 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: |
| 214 case WM_EVENT_TOGGLE_MAXIMIZE: | 221 case WM_EVENT_TOGGLE_MAXIMIZE: |
| 215 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: | 222 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: |
| 216 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: | 223 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: |
| 217 case WM_EVENT_TOGGLE_FULLSCREEN: | 224 case WM_EVENT_TOGGLE_FULLSCREEN: |
| 218 case WM_EVENT_CYCLE_SNAP_DOCK_LEFT: | 225 case WM_EVENT_CYCLE_SNAP_DOCK_LEFT: |
| 219 case WM_EVENT_CYCLE_SNAP_DOCK_RIGHT: | 226 case WM_EVENT_CYCLE_SNAP_DOCK_RIGHT: |
| 220 case WM_EVENT_CENTER: | 227 case WM_EVENT_CENTER: |
| 221 NOTREACHED() << "Compound event should not reach here:" << event; | 228 NOTREACHED() << "Compound event should not reach here:" << event; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 749 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); |
| 743 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 750 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
| 744 window_state->SetBoundsDirectAnimated(center_in_parent); | 751 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 745 } | 752 } |
| 746 // Centering window is treated as if a user moved and resized the window. | 753 // Centering window is treated as if a user moved and resized the window. |
| 747 window_state->set_bounds_changed_by_user(true); | 754 window_state->set_bounds_changed_by_user(true); |
| 748 } | 755 } |
| 749 | 756 |
| 750 } // namespace wm | 757 } // namespace wm |
| 751 } // namespace ash | 758 } // namespace ash |
| OLD | NEW |