Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: trunk/src/ash/wm/workspace/frame_maximize_button.cc

Issue 19668011: Revert 213347 "Use GetDisplayNearestWindow instead of GetDislpa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()->GetDisplayNearestWindow( 600 gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(bounds).work_area();
601 frame_->GetWidget()->GetNativeView()).work_area();
602 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100) 601 if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100)
603 return FRAME_STATE_NONE; 602 return FRAME_STATE_NONE;
604 // We might still have a horizontally filled window at this point which we 603 // We might still have a horizontally filled window at this point which we
605 // treat as no special state. 604 // treat as no special state.
606 if (bounds.y() != screen.y() || bounds.height() != screen.height()) 605 if (bounds.y() != screen.y() || bounds.height() != screen.height())
607 return FRAME_STATE_NONE; 606 return FRAME_STATE_NONE;
608 607
609 // We have to be in a maximize mode at this point. 608 // We have to be in a maximize mode at this point.
610 if (bounds.x() == screen.x()) 609 if (bounds.x() == screen.x())
611 return FRAME_STATE_SNAP_LEFT; 610 return FRAME_STATE_SNAP_LEFT;
612 if (bounds.right() == screen.right()) 611 if (bounds.right() == screen.right())
613 return FRAME_STATE_SNAP_RIGHT; 612 return FRAME_STATE_SNAP_RIGHT;
614 // If we come here, it is likely caused by the fact that the 613 // If we come here, it is likely caused by the fact that the
615 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case 614 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case
616 // we allow all maximize operations (and keep the restore rectangle). 615 // we allow all maximize operations (and keep the restore rectangle).
617 return FRAME_STATE_NONE; 616 return FRAME_STATE_NONE;
618 } 617 }
619 618
620 } // namespace ash 619 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/wm/workspace/auto_window_management.cc ('k') | trunk/src/chrome/browser/ui/views/chrome_views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698