| 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/wm/default_state.h" | 5 #include "ash/wm/default_state.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" | 11 #include "ash/shell_port.h" |
| 11 #include "ash/wm/screen_pinning_controller.h" | 12 #include "ash/wm/screen_pinning_controller.h" |
| 12 #include "ash/wm/window_animation_types.h" | 13 #include "ash/wm/window_animation_types.h" |
| 13 #include "ash/wm/window_parenting_utils.h" | 14 #include "ash/wm/window_parenting_utils.h" |
| 14 #include "ash/wm/window_positioning_utils.h" | 15 #include "ash/wm/window_positioning_utils.h" |
| 15 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/window_state_delegate.h" | 17 #include "ash/wm/window_state_delegate.h" |
| 17 #include "ash/wm/window_state_util.h" | 18 #include "ash/wm/window_state_util.h" |
| 18 #include "ash/wm/wm_event.h" | 19 #include "ash/wm/wm_event.h" |
| 19 #include "ash/wm/wm_screen_util.h" | |
| 20 #include "ash/wm_window.h" | 20 #include "ash/wm_window.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/display/display.h" | 22 #include "ui/display/display.h" |
| 23 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 namespace wm { | 26 namespace wm { |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // This specifies how much percent (30%) of a window rect | 29 // This specifies how much percent (30%) of a window rect |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (window_state->IsFullscreen()) { | 243 if (window_state->IsFullscreen()) { |
| 244 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); | 244 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); |
| 245 window_state->OnWMEvent(&event); | 245 window_state->OnWMEvent(&event); |
| 246 } else if (window_state->IsMaximized()) { | 246 } else if (window_state->IsMaximized()) { |
| 247 window_state->Restore(); | 247 window_state->Restore(); |
| 248 } else if (window_state->CanMaximize()) { | 248 } else if (window_state->CanMaximize()) { |
| 249 window_state->Maximize(); | 249 window_state->Maximize(); |
| 250 } | 250 } |
| 251 return true; | 251 return true; |
| 252 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: { | 252 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: { |
| 253 gfx::Rect work_area = GetDisplayWorkAreaBoundsInParent(window); | 253 gfx::Rect work_area = |
| 254 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window()); |
| 254 | 255 |
| 255 // Maximize vertically if: | 256 // Maximize vertically if: |
| 256 // - The window does not have a max height defined. | 257 // - The window does not have a max height defined. |
| 257 // - The window has the normal state type. Snapped windows are excluded | 258 // - The window has the normal state type. Snapped windows are excluded |
| 258 // because they are already maximized vertically and reverting to the | 259 // because they are already maximized vertically and reverting to the |
| 259 // restored bounds looks weird. | 260 // restored bounds looks weird. |
| 260 if (window->GetMaximumSize().height() != 0 || | 261 if (window->GetMaximumSize().height() != 0 || |
| 261 !window_state->IsNormalStateType()) { | 262 !window_state->IsNormalStateType()) { |
| 262 return true; | 263 return true; |
| 263 } | 264 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 274 return true; | 275 return true; |
| 275 } | 276 } |
| 276 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: { | 277 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: { |
| 277 // Maximize horizontally if: | 278 // Maximize horizontally if: |
| 278 // - The window does not have a max width defined. | 279 // - The window does not have a max width defined. |
| 279 // - The window is snapped or has the normal state type. | 280 // - The window is snapped or has the normal state type. |
| 280 if (window->GetMaximumSize().width() != 0) | 281 if (window->GetMaximumSize().width() != 0) |
| 281 return true; | 282 return true; |
| 282 if (!window_state->IsNormalOrSnapped()) | 283 if (!window_state->IsNormalOrSnapped()) |
| 283 return true; | 284 return true; |
| 284 gfx::Rect work_area = GetDisplayWorkAreaBoundsInParent(window); | 285 gfx::Rect work_area = |
| 286 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window()); |
| 285 if (window_state->IsNormalStateType() && | 287 if (window_state->IsNormalStateType() && |
| 286 window_state->HasRestoreBounds() && | 288 window_state->HasRestoreBounds() && |
| 287 (window->GetBounds().width() == work_area.width() && | 289 (window->GetBounds().width() == work_area.width() && |
| 288 window->GetBounds().x() == work_area.x())) { | 290 window->GetBounds().x() == work_area.x())) { |
| 289 window_state->SetAndClearRestoreBounds(); | 291 window_state->SetAndClearRestoreBounds(); |
| 290 } else { | 292 } else { |
| 291 gfx::Rect new_bounds(work_area.x(), window->GetBounds().y(), | 293 gfx::Rect new_bounds(work_area.x(), window->GetBounds().y(), |
| 292 work_area.width(), window->GetBounds().height()); | 294 work_area.width(), window->GetBounds().height()); |
| 293 | 295 |
| 294 gfx::Rect restore_bounds = window->GetBounds(); | 296 gfx::Rect restore_bounds = window->GetBounds(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // Only windows of type WINDOW_TYPE_NORMAL or WINDOW_TYPE_PANEL need to be | 364 // Only windows of type WINDOW_TYPE_NORMAL or WINDOW_TYPE_PANEL need to be |
| 363 // adjusted to have minimum visibility, because they are positioned by the | 365 // adjusted to have minimum visibility, because they are positioned by the |
| 364 // user and user should always be able to interact with them. Other | 366 // user and user should always be able to interact with them. Other |
| 365 // windows are positioned programmatically. | 367 // windows are positioned programmatically. |
| 366 if (!window_state->IsUserPositionable()) | 368 if (!window_state->IsUserPositionable()) |
| 367 return true; | 369 return true; |
| 368 | 370 |
| 369 // Use entire display instead of workarea. The logic ensures 30% | 371 // Use entire display instead of workarea. The logic ensures 30% |
| 370 // visibility which should be enough to see where the window gets | 372 // visibility which should be enough to see where the window gets |
| 371 // moved. | 373 // moved. |
| 372 gfx::Rect display_area = GetDisplayBoundsInParent(window); | 374 gfx::Rect display_area = |
| 375 ScreenUtil::GetDisplayBoundsInParent(window->aura_window()); |
| 373 int min_width = bounds.width() * wm::kMinimumPercentOnScreenArea; | 376 int min_width = bounds.width() * wm::kMinimumPercentOnScreenArea; |
| 374 int min_height = bounds.height() * wm::kMinimumPercentOnScreenArea; | 377 int min_height = bounds.height() * wm::kMinimumPercentOnScreenArea; |
| 375 wm::AdjustBoundsToEnsureWindowVisibility(display_area, min_width, | 378 wm::AdjustBoundsToEnsureWindowVisibility(display_area, min_width, |
| 376 min_height, &bounds); | 379 min_height, &bounds); |
| 377 window_state->AdjustSnappedBounds(&bounds); | 380 window_state->AdjustSnappedBounds(&bounds); |
| 378 if (window->GetBounds() != bounds) | 381 if (window->GetBounds() != bounds) |
| 379 window_state->SetBoundsConstrained(bounds); | 382 window_state->SetBoundsConstrained(bounds); |
| 380 return true; | 383 return true; |
| 381 } | 384 } |
| 382 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: { | 385 case WM_EVENT_DISPLAY_BOUNDS_CHANGED: { |
| 383 if (window_state->is_dragged() || | 386 if (window_state->is_dragged() || |
| 384 window_state->allow_set_bounds_direct() || | 387 window_state->allow_set_bounds_direct() || |
| 385 SetMaximizedOrFullscreenBounds(window_state)) { | 388 SetMaximizedOrFullscreenBounds(window_state)) { |
| 386 return true; | 389 return true; |
| 387 } | 390 } |
| 388 gfx::Rect work_area_in_parent = | 391 gfx::Rect work_area_in_parent = |
| 389 GetDisplayWorkAreaBoundsInParent(window_state->window()); | 392 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 393 window_state->window()->aura_window()); |
| 390 gfx::Rect bounds = window_state->window()->GetTargetBounds(); | 394 gfx::Rect bounds = window_state->window()->GetTargetBounds(); |
| 391 // When display bounds has changed, make sure the entire window is fully | 395 // When display bounds has changed, make sure the entire window is fully |
| 392 // visible. | 396 // visible. |
| 393 bounds.AdjustToFit(work_area_in_parent); | 397 bounds.AdjustToFit(work_area_in_parent); |
| 394 window_state->AdjustSnappedBounds(&bounds); | 398 window_state->AdjustSnappedBounds(&bounds); |
| 395 if (window_state->window()->GetTargetBounds() != bounds) | 399 if (window_state->window()->GetTargetBounds() != bounds) |
| 396 window_state->SetBoundsDirectAnimated(bounds); | 400 window_state->SetBoundsDirectAnimated(bounds); |
| 397 return true; | 401 return true; |
| 398 } | 402 } |
| 399 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: { | 403 case WM_EVENT_WORKAREA_BOUNDS_CHANGED: { |
| 400 // Don't resize the maximized window when the desktop is covered | 404 // Don't resize the maximized window when the desktop is covered |
| 401 // by fullscreen window. crbug.com/504299. | 405 // by fullscreen window. crbug.com/504299. |
| 402 bool in_fullscreen = | 406 bool in_fullscreen = |
| 403 window_state->window() | 407 window_state->window() |
| 404 ->GetRootWindowController() | 408 ->GetRootWindowController() |
| 405 ->GetWorkspaceWindowState() == WORKSPACE_WINDOW_STATE_FULL_SCREEN; | 409 ->GetWorkspaceWindowState() == WORKSPACE_WINDOW_STATE_FULL_SCREEN; |
| 406 if (in_fullscreen && window_state->IsMaximized()) | 410 if (in_fullscreen && window_state->IsMaximized()) |
| 407 return true; | 411 return true; |
| 408 | 412 |
| 409 if (window_state->is_dragged() || | 413 if (window_state->is_dragged() || |
| 410 window_state->allow_set_bounds_direct() || | 414 window_state->allow_set_bounds_direct() || |
| 411 SetMaximizedOrFullscreenBounds(window_state)) { | 415 SetMaximizedOrFullscreenBounds(window_state)) { |
| 412 return true; | 416 return true; |
| 413 } | 417 } |
| 414 gfx::Rect work_area_in_parent = | 418 gfx::Rect work_area_in_parent = |
| 415 GetDisplayWorkAreaBoundsInParent(window_state->window()); | 419 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 420 window_state->window()->aura_window()); |
| 416 gfx::Rect bounds = window_state->window()->GetTargetBounds(); | 421 gfx::Rect bounds = window_state->window()->GetTargetBounds(); |
| 417 if (!window_state->window()->GetTransientParent()) { | 422 if (!window_state->window()->GetTransientParent()) { |
| 418 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, | 423 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, |
| 419 &bounds); | 424 &bounds); |
| 420 } | 425 } |
| 421 window_state->AdjustSnappedBounds(&bounds); | 426 window_state->AdjustSnappedBounds(&bounds); |
| 422 if (window_state->window()->GetTargetBounds() != bounds) | 427 if (window_state->window()->GetTargetBounds() != bounds) |
| 423 window_state->SetBoundsDirectAnimated(bounds); | 428 window_state->SetBoundsDirectAnimated(bounds); |
| 424 return true; | 429 return true; |
| 425 } | 430 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 444 break; | 449 break; |
| 445 } | 450 } |
| 446 return false; | 451 return false; |
| 447 } | 452 } |
| 448 | 453 |
| 449 // static | 454 // static |
| 450 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) { | 455 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) { |
| 451 DCHECK(!window_state->is_dragged()); | 456 DCHECK(!window_state->is_dragged()); |
| 452 DCHECK(!window_state->allow_set_bounds_direct()); | 457 DCHECK(!window_state->allow_set_bounds_direct()); |
| 453 if (window_state->IsMaximized()) { | 458 if (window_state->IsMaximized()) { |
| 454 window_state->SetBoundsDirect( | 459 window_state->SetBoundsDirect(ScreenUtil::GetMaximizedWindowBoundsInParent( |
| 455 GetMaximizedWindowBoundsInParent(window_state->window())); | 460 window_state->window()->aura_window())); |
| 456 return true; | 461 return true; |
| 457 } | 462 } |
| 458 if (window_state->IsFullscreen()) { | 463 if (window_state->IsFullscreen()) { |
| 459 window_state->SetBoundsDirect( | 464 window_state->SetBoundsDirect(ScreenUtil::GetDisplayBoundsInParent( |
| 460 GetDisplayBoundsInParent(window_state->window())); | 465 window_state->window()->aura_window())); |
| 461 return true; | 466 return true; |
| 462 } | 467 } |
| 463 return false; | 468 return false; |
| 464 } | 469 } |
| 465 | 470 |
| 466 // static | 471 // static |
| 467 void DefaultState::SetBounds(WindowState* window_state, | 472 void DefaultState::SetBounds(WindowState* window_state, |
| 468 const SetBoundsEvent* event) { | 473 const SetBoundsEvent* event) { |
| 469 if (window_state->is_dragged() || window_state->allow_set_bounds_direct()) { | 474 if (window_state->is_dragged() || window_state->allow_set_bounds_direct()) { |
| 470 // TODO(oshima|varkha): Is this still needed? crbug.com/485612. | 475 // TODO(oshima|varkha): Is this still needed? crbug.com/485612. |
| 471 window_state->SetBoundsDirect(event->requested_bounds()); | 476 window_state->SetBoundsDirect(event->requested_bounds()); |
| 472 } else if (window_state->IsSnapped()) { | 477 } else if (window_state->IsSnapped()) { |
| 473 gfx::Rect work_area_in_parent = | 478 gfx::Rect work_area_in_parent = |
| 474 GetDisplayWorkAreaBoundsInParent(window_state->window()); | 479 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 480 window_state->window()->aura_window()); |
| 475 gfx::Rect child_bounds(event->requested_bounds()); | 481 gfx::Rect child_bounds(event->requested_bounds()); |
| 476 wm::AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds); | 482 wm::AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds); |
| 477 window_state->AdjustSnappedBounds(&child_bounds); | 483 window_state->AdjustSnappedBounds(&child_bounds); |
| 478 window_state->SetBoundsDirect(child_bounds); | 484 window_state->SetBoundsDirect(child_bounds); |
| 479 } else if (!SetMaximizedOrFullscreenBounds(window_state)) { | 485 } else if (!SetMaximizedOrFullscreenBounds(window_state)) { |
| 480 window_state->SetBoundsConstrained(event->requested_bounds()); | 486 window_state->SetBoundsConstrained(event->requested_bounds()); |
| 481 } | 487 } |
| 482 } | 488 } |
| 483 | 489 |
| 484 void DefaultState::EnterToNextState(WindowState* window_state, | 490 void DefaultState::EnterToNextState(WindowState* window_state, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 case WINDOW_STATE_TYPE_LEFT_SNAPPED: | 590 case WINDOW_STATE_TYPE_LEFT_SNAPPED: |
| 585 case WINDOW_STATE_TYPE_RIGHT_SNAPPED: | 591 case WINDOW_STATE_TYPE_RIGHT_SNAPPED: |
| 586 bounds_in_parent = | 592 bounds_in_parent = |
| 587 state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED | 593 state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED |
| 588 ? GetDefaultLeftSnappedWindowBoundsInParent(window) | 594 ? GetDefaultLeftSnappedWindowBoundsInParent(window) |
| 589 : GetDefaultRightSnappedWindowBoundsInParent(window); | 595 : GetDefaultRightSnappedWindowBoundsInParent(window); |
| 590 break; | 596 break; |
| 591 | 597 |
| 592 case WINDOW_STATE_TYPE_DEFAULT: | 598 case WINDOW_STATE_TYPE_DEFAULT: |
| 593 case WINDOW_STATE_TYPE_NORMAL: { | 599 case WINDOW_STATE_TYPE_NORMAL: { |
| 594 gfx::Rect work_area_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 600 gfx::Rect work_area_in_parent = |
| 601 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window()); |
| 595 if (window_state->HasRestoreBounds()) { | 602 if (window_state->HasRestoreBounds()) { |
| 596 bounds_in_parent = window_state->GetRestoreBoundsInParent(); | 603 bounds_in_parent = window_state->GetRestoreBoundsInParent(); |
| 597 // Check if the |window|'s restored size is bigger than the working area | 604 // Check if the |window|'s restored size is bigger than the working area |
| 598 // This may happen if a window was resized to maximized bounds or if the | 605 // This may happen if a window was resized to maximized bounds or if the |
| 599 // display resolution changed while the window was maximized. | 606 // display resolution changed while the window was maximized. |
| 600 if (previous_state_type == WINDOW_STATE_TYPE_MAXIMIZED && | 607 if (previous_state_type == WINDOW_STATE_TYPE_MAXIMIZED && |
| 601 bounds_in_parent.width() >= work_area_in_parent.width() && | 608 bounds_in_parent.width() >= work_area_in_parent.width() && |
| 602 bounds_in_parent.height() >= work_area_in_parent.height()) { | 609 bounds_in_parent.height() >= work_area_in_parent.height()) { |
| 603 bounds_in_parent = work_area_in_parent; | 610 bounds_in_parent = work_area_in_parent; |
| 604 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset, | 611 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset, |
| 605 kMaximizedWindowInset, kMaximizedWindowInset); | 612 kMaximizedWindowInset, kMaximizedWindowInset); |
| 606 } | 613 } |
| 607 } else { | 614 } else { |
| 608 bounds_in_parent = window->GetBounds(); | 615 bounds_in_parent = window->GetBounds(); |
| 609 } | 616 } |
| 610 // Make sure that part of the window is always visible. | 617 // Make sure that part of the window is always visible. |
| 611 if (!window_state->is_dragged()) { | 618 if (!window_state->is_dragged()) { |
| 612 // Avoid doing this while the window is being dragged as its root | 619 // Avoid doing this while the window is being dragged as its root |
| 613 // window hasn't been updated yet in the case of dragging to another | 620 // window hasn't been updated yet in the case of dragging to another |
| 614 // display. crbug.com/666836. | 621 // display. crbug.com/666836. |
| 615 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, | 622 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, |
| 616 &bounds_in_parent); | 623 &bounds_in_parent); |
| 617 } | 624 } |
| 618 break; | 625 break; |
| 619 } | 626 } |
| 620 case WINDOW_STATE_TYPE_MAXIMIZED: | 627 case WINDOW_STATE_TYPE_MAXIMIZED: |
| 621 bounds_in_parent = GetMaximizedWindowBoundsInParent(window); | 628 bounds_in_parent = |
| 629 ScreenUtil::GetMaximizedWindowBoundsInParent(window->aura_window()); |
| 622 break; | 630 break; |
| 623 | 631 |
| 624 case WINDOW_STATE_TYPE_FULLSCREEN: | 632 case WINDOW_STATE_TYPE_FULLSCREEN: |
| 625 case WINDOW_STATE_TYPE_PINNED: | 633 case WINDOW_STATE_TYPE_PINNED: |
| 626 case WINDOW_STATE_TYPE_TRUSTED_PINNED: | 634 case WINDOW_STATE_TYPE_TRUSTED_PINNED: |
| 627 bounds_in_parent = GetDisplayBoundsInParent(window); | 635 bounds_in_parent = |
| 636 ScreenUtil::GetDisplayBoundsInParent(window->aura_window()); |
| 628 break; | 637 break; |
| 629 | 638 |
| 630 case WINDOW_STATE_TYPE_MINIMIZED: | 639 case WINDOW_STATE_TYPE_MINIMIZED: |
| 631 break; | 640 break; |
| 632 case WINDOW_STATE_TYPE_INACTIVE: | 641 case WINDOW_STATE_TYPE_INACTIVE: |
| 633 case WINDOW_STATE_TYPE_END: | 642 case WINDOW_STATE_TYPE_END: |
| 634 case WINDOW_STATE_TYPE_AUTO_POSITIONED: | 643 case WINDOW_STATE_TYPE_AUTO_POSITIONED: |
| 635 return; | 644 return; |
| 636 } | 645 } |
| 637 | 646 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 WmWindow* window = window_state->window(); | 693 WmWindow* window = window_state->window(); |
| 685 if (window_state->IsSnapped()) { | 694 if (window_state->IsSnapped()) { |
| 686 gfx::Rect center_in_screen = window->GetDisplayNearestWindow().work_area(); | 695 gfx::Rect center_in_screen = window->GetDisplayNearestWindow().work_area(); |
| 687 gfx::Size size = window_state->HasRestoreBounds() | 696 gfx::Size size = window_state->HasRestoreBounds() |
| 688 ? window_state->GetRestoreBoundsInScreen().size() | 697 ? window_state->GetRestoreBoundsInScreen().size() |
| 689 : window->GetBounds().size(); | 698 : window->GetBounds().size(); |
| 690 center_in_screen.ClampToCenteredSize(size); | 699 center_in_screen.ClampToCenteredSize(size); |
| 691 window_state->SetRestoreBoundsInScreen(center_in_screen); | 700 window_state->SetRestoreBoundsInScreen(center_in_screen); |
| 692 window_state->Restore(); | 701 window_state->Restore(); |
| 693 } else { | 702 } else { |
| 694 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); | 703 gfx::Rect center_in_parent = |
| 704 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window()); |
| 695 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); | 705 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); |
| 696 window_state->SetBoundsDirectAnimated(center_in_parent); | 706 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 697 } | 707 } |
| 698 // Centering window is treated as if a user moved and resized the window. | 708 // Centering window is treated as if a user moved and resized the window. |
| 699 window_state->set_bounds_changed_by_user(true); | 709 window_state->set_bounds_changed_by_user(true); |
| 700 } | 710 } |
| 701 | 711 |
| 702 } // namespace wm | 712 } // namespace wm |
| 703 } // namespace ash | 713 } // namespace ash |
| OLD | NEW |