| 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/maximize_mode/maximize_mode_window_state.h" | 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 10 #include "ash/common/wm/window_animation_types.h" | 10 #include "ash/common/wm/window_animation_types.h" |
| 11 #include "ash/common/wm/window_state_util.h" | 11 #include "ash/common/wm/window_state_util.h" |
| 12 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
| 13 #include "ash/common/wm/wm_screen_util.h" | 13 #include "ash/common/wm/wm_screen_util.h" |
| 14 #include "ash/common/wm_shell.h" | |
| 15 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 16 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "ash/shell.h" |
| 17 #include "ash/wm/screen_pinning_controller.h" |
| 17 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // Returns the biggest possible size for a window which is about to be | 24 // Returns the biggest possible size for a window which is about to be |
| 24 // maximized. | 25 // maximized. |
| 25 gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) { | 26 gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) { |
| 26 DCHECK(window_state->CanMaximize() || window_state->CanResize()); | 27 DCHECK(window_state->CanMaximize() || window_state->CanResize()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, | 122 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, |
| 122 const wm::WMEvent* event) { | 123 const wm::WMEvent* event) { |
| 123 switch (event->type()) { | 124 switch (event->type()) { |
| 124 case wm::WM_EVENT_TOGGLE_FULLSCREEN: | 125 case wm::WM_EVENT_TOGGLE_FULLSCREEN: |
| 125 ToggleFullScreen(window_state, window_state->delegate()); | 126 ToggleFullScreen(window_state, window_state->delegate()); |
| 126 break; | 127 break; |
| 127 case wm::WM_EVENT_FULLSCREEN: | 128 case wm::WM_EVENT_FULLSCREEN: |
| 128 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true); | 129 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true); |
| 129 break; | 130 break; |
| 130 case wm::WM_EVENT_PIN: | 131 case wm::WM_EVENT_PIN: |
| 131 if (!WmShell::Get()->IsPinned()) | 132 if (!Shell::Get()->screen_pinning_controller()->IsPinned()) |
| 132 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true); | 133 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true); |
| 133 break; | 134 break; |
| 134 case wm::WM_EVENT_TRUSTED_PIN: | 135 case wm::WM_EVENT_TRUSTED_PIN: |
| 135 if (!WmShell::Get()->IsPinned()) | 136 if (!Shell::Get()->screen_pinning_controller()->IsPinned()) |
| 136 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_TRUSTED_PINNED, true); | 137 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_TRUSTED_PINNED, true); |
| 137 break; | 138 break; |
| 138 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: | 139 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: |
| 139 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: | 140 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: |
| 140 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: | 141 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: |
| 141 case wm::WM_EVENT_TOGGLE_MAXIMIZE: | 142 case wm::WM_EVENT_TOGGLE_MAXIMIZE: |
| 142 case wm::WM_EVENT_CYCLE_SNAP_LEFT: | 143 case wm::WM_EVENT_CYCLE_SNAP_LEFT: |
| 143 case wm::WM_EVENT_CYCLE_SNAP_RIGHT: | 144 case wm::WM_EVENT_CYCLE_SNAP_RIGHT: |
| 144 case wm::WM_EVENT_CENTER: | 145 case wm::WM_EVENT_CENTER: |
| 145 case wm::WM_EVENT_SNAP_LEFT: | 146 case wm::WM_EVENT_SNAP_LEFT: |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } else { | 275 } else { |
| 275 UpdateBounds(window_state, animated); | 276 UpdateBounds(window_state, animated); |
| 276 } | 277 } |
| 277 | 278 |
| 278 window_state->NotifyPostStateTypeChange(old_state_type); | 279 window_state->NotifyPostStateTypeChange(old_state_type); |
| 279 | 280 |
| 280 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED || | 281 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED || |
| 281 target_state == wm::WINDOW_STATE_TYPE_PINNED || | 282 target_state == wm::WINDOW_STATE_TYPE_PINNED || |
| 282 old_state_type == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED || | 283 old_state_type == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED || |
| 283 target_state == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) { | 284 target_state == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) { |
| 284 WmShell::Get()->SetPinnedWindow(window_state->window()); | 285 Shell::Get()->screen_pinning_controller()->SetPinnedWindow( |
| 286 window_state->window()); |
| 285 } | 287 } |
| 286 | 288 |
| 287 if ((window_state->window()->GetTargetVisibility() || | 289 if ((window_state->window()->GetTargetVisibility() || |
| 288 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) && | 290 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) && |
| 289 !window_state->window()->GetLayer()->visible()) { | 291 !window_state->window()->GetLayer()->visible()) { |
| 290 // The layer may be hidden if the window was previously minimized. Make | 292 // The layer may be hidden if the window was previously minimized. Make |
| 291 // sure it's visible. | 293 // sure it's visible. |
| 292 window_state->window()->Show(); | 294 window_state->window()->Show(); |
| 293 } | 295 } |
| 294 } | 296 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 316 // avoid flashing. | 318 // avoid flashing. |
| 317 if (window_state->IsMaximized()) | 319 if (window_state->IsMaximized()) |
| 318 window_state->SetBoundsDirectCrossFade(bounds_in_parent); | 320 window_state->SetBoundsDirectCrossFade(bounds_in_parent); |
| 319 else | 321 else |
| 320 window_state->SetBoundsDirectAnimated(bounds_in_parent); | 322 window_state->SetBoundsDirectAnimated(bounds_in_parent); |
| 321 } | 323 } |
| 322 } | 324 } |
| 323 } | 325 } |
| 324 | 326 |
| 325 } // namespace ash | 327 } // namespace ash |
| OLD | NEW |