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

Unified Diff: ash/wm/workspace/snap_sizer.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/snap_sizer.cc
diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
index 6403740ceb372b71bfaf411d89f0e0d9a697a62d..8447fd2b42806604c74718b9507d9c6aa265e12f 100644
--- a/ash/wm/workspace/snap_sizer.cc
+++ b/ash/wm/workspace/snap_sizer.cc
@@ -6,6 +6,7 @@
#include <cmath>
+#include "ash/ash_switches.h"
#include "ash/screen_ash.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_resizer.h"
@@ -62,7 +63,16 @@ int GetMaxWidth(aura::Window* window) {
// in the SnapSizer.
int GetDefaultWidth(aura::Window* window) {
gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window));
- int width = std::max(kDefaultWidthSmallScreen, work_area.width() / 2);
+
+ int width = 0;
+ if (ash::switches::UseAlternateFrameCaptionButtonStyle()) {
+ // Only the 'half of screen' width is supported when using the alternate
+ // visual style for the frame caption buttons (minimize, maximize, restore,
+ // and close).
+ width = work_area.width() / 2;
+ } else {
+ width = std::max(kDefaultWidthSmallScreen, work_area.width() / 2);
+ }
width = std::min(width, GetMaxWidth(window));
return std::max(width, GetMinWidth(window));
@@ -74,6 +84,13 @@ int GetDefaultWidth(aura::Window* window) {
// add an entry for 90% of the screen size if it is smaller than the biggest
// value in the |kIdealWidth| list (to get a step between the values).
std::vector<int> BuildIdealWidthList(aura::Window* window) {
+ if (ash::switches::UseAlternateFrameCaptionButtonStyle()) {
+ // Only the 'half of screen' width is supported when using the alternate
+ // visual style for the frame caption buttons (minimize, maximize,
+ // restore, and close).
+ return std::vector<int>(1u, GetDefaultWidth(window));
+ }
+
int minimum_width = GetMinWidth(window);
int maximum_width = GetMaxWidth(window);
@@ -193,6 +210,8 @@ gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) {
}
}
}
+ if (current < 0)
James Cook 2013/09/10 20:49:08 Ah, thanks for adding this.
+ current = 0;
return GetTargetBoundsForSize(current % usable_width_.size());
}

Powered by Google App Engine
This is Rietveld 408576698