Commit 2a13a9a2 authored by skuhne@chromium.org's avatar skuhne@chromium.org

Add a maximizing logic flag

BUG=230866
TEST=visual

Review URL: https://chromiumcodereview.appspot.com/14222010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195086 0039d316-1c4b-4281-b951-d872f2087c98
parent 54fd93bc
......@@ -33,6 +33,9 @@ const char kAshCopyHostBackgroundAtBoot[] = "ash-copy-host-background-at-boot";
// Enable keyboard shortcuts useful for debugging.
const char kAshDebugShortcuts[] = "ash-debug-shortcuts";
// Disable auto window maximization logic.
const char kAshDisableAutoMaximizing[] = "ash-disable-auto-maximizing";
// Disable support for auto window placement.
const char kAshDisableAutoWindowPlacement[] =
"ash-enable-auto-window-placement";
......
......@@ -23,6 +23,7 @@ ASH_EXPORT extern const char kAshBootAnimationFunction3[];
ASH_EXPORT extern const char kAshConstrainPointerToRoot[];
ASH_EXPORT extern const char kAshCopyHostBackgroundAtBoot[];
ASH_EXPORT extern const char kAshDebugShortcuts[];
ASH_EXPORT extern const char kAshDisableAutoMaximizing[];
ASH_EXPORT extern const char kAshDisableAutoWindowPlacement[];
ASH_EXPORT extern const char kAshDisableBootAnimation2[];
ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[];
......
......@@ -6716,6 +6716,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_DESCRIPTION" desc="Description for the option to enable/disable the auto window placement functionality.">
Disable automatic window placement for one and two browser / app windows.
</message>
<message name="IDS_FLAGS_ASH_AUTO_MAXIMIZING_NAME" desc="Name for the option to disable the auto window maximizing functionality.">
Disable automatic window maximization
</message>
<message name="IDS_FLAGS_ASH_AUTO_MAXIMIZING_DESCRIPTION" desc="Description for the option to disable the auto window maximizing functionality.">
Disable automatic window maximization for browser / app windows if they are started the first time.
</message>
<message name="IDS_FLAGS_ASH_DISABLE_PER_APP_LAUNCHER_NAME" desc="Name for the option to enable/disable the per application sorting launcher functionality.">
Disable per application sorting in the launcher.
</message>
......
......@@ -714,6 +714,13 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(switches::kEnableManagedUsers)
},
#if defined(USE_ASH)
{
"ash-disable-auto-maximizing",
IDS_FLAGS_ASH_AUTO_MAXIMIZING_NAME,
IDS_FLAGS_ASH_AUTO_MAXIMIZING_DESCRIPTION,
kOsWin | kOsLinux | kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoMaximizing)
},
{
"ash-disable-auto-window-placement",
IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_NAME,
......
......@@ -4,9 +4,11 @@
#include "chrome/browser/ui/window_sizer/window_sizer.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/wm/window_cycle_controller.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/browser.h"
......@@ -22,8 +24,10 @@
namespace {
// When a window gets opened in default mode and the screen is less then this
// width, the window will get opened in maximized mode.
// width, the window will get opened in maximized mode. This value can be
// reduced to a "tame" number if the feature is disabled.
const int kForceMaximizeWidthLimit = 1366;
const int kForceMaximizeWidthLimitDisabled = 640;
// Check if the given browser is 'valid': It is a tabbed, non minimized
// window, which intersects with the |bounds_in_screen| area of a given screen.
......@@ -135,7 +139,13 @@ bool MoveRect(const gfx::Rect& work_area,
// static
int WindowSizer::GetForceMaximizedWidthLimit() {
return kForceMaximizeWidthLimit;
static int maximum_limit = 0;
if (!maximum_limit) {
maximum_limit = CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshDisableAutoMaximizing) ?
kForceMaximizeWidthLimitDisabled : kForceMaximizeWidthLimit;
}
return maximum_limit;
}
bool WindowSizer::GetBoundsOverrideAsh(gfx::Rect* bounds_in_screen,
......@@ -172,7 +182,7 @@ bool WindowSizer::GetBoundsOverrideAsh(gfx::Rect* bounds_in_screen,
// When using "small screens" we want to always open in full screen mode.
if (passed_show_state == ui::SHOW_STATE_DEFAULT &&
!browser_->is_session_restore() &&
work_area.width() < kForceMaximizeWidthLimit &&
work_area.width() < GetForceMaximizedWidthLimit() &&
(!browser_->window() || !browser_->window()->IsFullscreen()) &&
(!browser_->fullscreen_controller() ||
!browser_->fullscreen_controller()->IsFullscreenForBrowser()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment