OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace/frame_maximize_button.h" | 5 #include "ash/wm/workspace/frame_maximize_button.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 FrameMaximizeButton::GetMaximizeBubbleFrameState() const { | 590 FrameMaximizeButton::GetMaximizeBubbleFrameState() const { |
591 // When there are no restore bounds, we are in normal mode. | 591 // When there are no restore bounds, we are in normal mode. |
592 if (!ash::GetRestoreBoundsInScreen( | 592 if (!ash::GetRestoreBoundsInScreen( |
593 frame_->GetWidget()->GetNativeWindow())) | 593 frame_->GetWidget()->GetNativeWindow())) |
594 return FRAME_STATE_NONE; | 594 return FRAME_STATE_NONE; |
595 // The normal maximized test can be used. | 595 // The normal maximized test can be used. |
596 if (frame_->GetWidget()->IsMaximized()) | 596 if (frame_->GetWidget()->IsMaximized()) |
597 return FRAME_STATE_FULL; | 597 return FRAME_STATE_FULL; |
598 // For Left/right maximize we need to check the dimensions. | 598 // For Left/right maximize we need to check the dimensions. |
599 gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen(); | 599 gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen(); |
600 gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(bounds).work_area(); | 600 gfx::Rect screen = Shell::GetScreen()->GetDisplayNearestWindow( |
| 601 frame_->GetWidget()->GetNativeView()).work_area(); |
601 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100) | 602 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100) |
602 return FRAME_STATE_NONE; | 603 return FRAME_STATE_NONE; |
603 // We might still have a horizontally filled window at this point which we | 604 // We might still have a horizontally filled window at this point which we |
604 // treat as no special state. | 605 // treat as no special state. |
605 if (bounds.y() != screen.y() || bounds.height() != screen.height()) | 606 if (bounds.y() != screen.y() || bounds.height() != screen.height()) |
606 return FRAME_STATE_NONE; | 607 return FRAME_STATE_NONE; |
607 | 608 |
608 // We have to be in a maximize mode at this point. | 609 // We have to be in a maximize mode at this point. |
609 if (bounds.x() == screen.x()) | 610 if (bounds.x() == screen.x()) |
610 return FRAME_STATE_SNAP_LEFT; | 611 return FRAME_STATE_SNAP_LEFT; |
611 if (bounds.right() == screen.right()) | 612 if (bounds.right() == screen.right()) |
612 return FRAME_STATE_SNAP_RIGHT; | 613 return FRAME_STATE_SNAP_RIGHT; |
613 // If we come here, it is likely caused by the fact that the | 614 // If we come here, it is likely caused by the fact that the |
614 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 615 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
615 // we allow all maximize operations (and keep the restore rectangle). | 616 // we allow all maximize operations (and keep the restore rectangle). |
616 return FRAME_STATE_NONE; | 617 return FRAME_STATE_NONE; |
617 } | 618 } |
618 | 619 |
619 } // namespace ash | 620 } // namespace ash |
OLD | NEW |