| 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/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/maximize_bubble_controller.h" | 10 #include "ash/wm/maximize_bubble_controller.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 frame_->GetWidget()->GetNativeWindow())) | 546 frame_->GetWidget()->GetNativeWindow())) |
| 547 return FRAME_STATE_NONE; | 547 return FRAME_STATE_NONE; |
| 548 // The normal maximized test can be used. | 548 // The normal maximized test can be used. |
| 549 if (frame_->GetWidget()->IsMaximized()) | 549 if (frame_->GetWidget()->IsMaximized()) |
| 550 return FRAME_STATE_FULL; | 550 return FRAME_STATE_FULL; |
| 551 // For Left/right maximize we need to check the dimensions. | 551 // For Left/right maximize we need to check the dimensions. |
| 552 gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen(); | 552 gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen(); |
| 553 gfx::Rect screen = gfx::Screen::GetDisplayMatching(bounds).work_area(); | 553 gfx::Rect screen = gfx::Screen::GetDisplayMatching(bounds).work_area(); |
| 554 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100) | 554 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100) |
| 555 return FRAME_STATE_NONE; | 555 return FRAME_STATE_NONE; |
| 556 // We might still have a horizontally filled window at this point which we |
| 557 // treat as no special state. |
| 558 if (bounds.y() != screen.y() || bounds.height() != screen.height()) |
| 559 return FRAME_STATE_NONE; |
| 560 |
| 556 // We have to be in a maximize mode at this point. | 561 // We have to be in a maximize mode at this point. |
| 557 DCHECK(bounds.y() == screen.y()); | |
| 558 DCHECK(bounds.height() >= screen.height()); | |
| 559 if (bounds.x() == screen.x()) | 562 if (bounds.x() == screen.x()) |
| 560 return FRAME_STATE_SNAP_LEFT; | 563 return FRAME_STATE_SNAP_LEFT; |
| 561 if (bounds.right() == screen.right()) | 564 if (bounds.right() == screen.right()) |
| 562 return FRAME_STATE_SNAP_RIGHT; | 565 return FRAME_STATE_SNAP_RIGHT; |
| 563 // If we come here, it is likely caused by the fact that the | 566 // If we come here, it is likely caused by the fact that the |
| 564 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 567 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
| 565 // we allow all maximize operations (and keep the restore rectangle). | 568 // we allow all maximize operations (and keep the restore rectangle). |
| 566 return FRAME_STATE_NONE; | 569 return FRAME_STATE_NONE; |
| 567 } | 570 } |
| 568 | 571 |
| 569 } // namespace ash | 572 } // namespace ash |
| OLD | NEW |