0

Enable immersive fullscreen for non-browser windows by default.

BUG=334473
TEST=None
R=jamescook
TBR=benwells (For trivial refactor in chrome/browser/ui/views/apps/native_app_window_views.cc)

Review URL: https://codereview.chromium.org/135053006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245075 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
pkotwicz@chromium.org
2014-01-16 02:46:05 +00:00
parent 208ad3af8b
commit 7dd4448974
9 changed files with 35 additions and 17 deletions

@ -108,6 +108,11 @@ const char kAshEnableBrightnessControl[] = "ash-enable-brightness-control";
const char kAshEnableImmersiveFullscreenForAllWindows[] =
"ash-enable-immersive-all-windows";
// Enables putting only browser windows into immersive fullscreen via <F4>.
// <F4> puts all other windows into non-immersive fullscreen.
const char kAshEnableImmersiveFullscreenForBrowserOnly[] =
"ash-enable-immersive-browser-only";
#if defined(OS_CHROMEOS)
// Enables the "full multi profile mode" - as it was in M-31.
const char kAshEnableFullMultiProfileMode[] =
@ -225,6 +230,11 @@ bool UseDragOffShelf() {
HasSwitch(kAshDisableDragOffShelf);
}
bool UseImmersiveFullscreenForAllWindows() {
return !CommandLine::ForCurrentProcess()->HasSwitch(
kAshEnableImmersiveFullscreenForBrowserOnly);
}
bool ShowShelfAlignmentMenu() {
return !CommandLine::ForCurrentProcess()->
HasSwitch(kHideShelfAlignmentMenu);

@ -44,6 +44,7 @@ ASH_EXPORT extern const char kAshEnableAdvancedGestures[];
ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[];
ASH_EXPORT extern const char kAshEnableBrightnessControl[];
ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForAllWindows[];
ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForBrowserOnly[];
#if defined(OS_CHROMEOS)
ASH_EXPORT extern const char kAshEnableFullMultiProfileMode[];
#endif
@ -86,6 +87,10 @@ ASH_EXPORT bool UseAlternateShelfLayout();
// Returns true if items can be dragged off the shelf to unpin.
ASH_EXPORT bool UseDragOffShelf();
// Returns true if all windows (barring frameless apps) can be put into
// immersive fullscreen via <F4>.
ASH_EXPORT bool UseImmersiveFullscreenForAllWindows();
// Returns true if side shelf alignment is enabled.
ASH_EXPORT bool ShowShelfAlignmentMenu();

@ -43,8 +43,8 @@ const gfx::Font& GetTitleFont() {
// CustomFrameViewAshWindowStateDelegate
// Handles a user's fullscreen request (Shift+F4/F4). Puts the window into
// immersive fullscreen if the kAshEnableImmersiveFullscreenForAllWindows
// flag is set.
// immersive fullscreen if immersive fullscreen is enabled for non-browser
// windows.
class CustomFrameViewAshWindowStateDelegate
: public ash::wm::WindowStateDelegate,
public ash::wm::WindowStateObserver,
@ -57,8 +57,7 @@ class CustomFrameViewAshWindowStateDelegate
#if defined(OS_CHROMEOS)
// TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
// Windows Ash.
if (CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows)) {
if (ash::switches::UseImmersiveFullscreenForAllWindows()) {
immersive_fullscreen_controller_.reset(
new ash::ImmersiveFullscreenController);
custom_frame_view->InitImmersiveFullscreenControllerForView(

@ -43,12 +43,11 @@ WindowState::WindowState(aura::Window* window)
#if defined(OS_CHROMEOS)
// NOTE(pkotwicz): Animating to immersive fullscreen does not look good. When
// the kAshEnableImmersiveFullscreenForAllWindows flag is set most windows
// switches::UseImmersiveFullscreenForAllWindows() returns true, most windows
// can be put into immersive fullscreen. It is not worth the added complexity
// to only animate to fullscreen if the window is put into immersive
// fullscreen.
animate_to_fullscreen_ = !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshEnableImmersiveFullscreenForAllWindows);
animate_to_fullscreen_ = !switches::UseImmersiveFullscreenForAllWindows();
#endif
}

@ -1017,11 +1017,13 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(ash::switches::kAshDisableDockedWindows)
},
{
"ash-enable-immersive-fullscreen-all-windows",
"ash-enable-immersive-fullscreen-all-windows2",
IDS_FLAGS_IMMERSIVE_FULLSCREEN_FOR_ALL_WINDOWS_NAME,
IDS_FLAGS_IMMERSIVE_FULLSCREEN_FOR_ALL_WINDOWS_DESCRIPTION,
kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kAshEnableImmersiveFullscreenForAllWindows)
ENABLE_DISABLE_VALUE_TYPE(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows,
ash::switches::kAshEnableImmersiveFullscreenForBrowserOnly)
},
#endif
{

@ -114,6 +114,9 @@ class AcceleratorCommandsFullscreenBrowserTest
if (put_all_windows_in_immersive_) {
CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows);
} else {
CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshEnableImmersiveFullscreenForBrowserOnly);
}
}
@ -303,6 +306,9 @@ class AcceleratorCommandsPlatformAppFullscreenBrowserTest
if (put_all_windows_in_immersive_) {
CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows);
} else {
CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshEnableImmersiveFullscreenForBrowserOnly);
}
extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
}

@ -728,8 +728,7 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
// Non-frameless app windows can be put into immersive fullscreen.
// TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
// Windows Ash.
if (CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows)) {
if (ash::switches::UseImmersiveFullscreenForAllWindows()) {
immersive_fullscreen_controller_.reset(
new ash::ImmersiveFullscreenController());
custom_frame_view->InitImmersiveFullscreenControllerForView(

@ -73,8 +73,8 @@ BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame,
// Animating to immersive fullscreen does not look good. Immersive
// fullscreen is the default fullscreen type on ChromeOS for tabbed browser
// windows. The WindowState constructor disables animating to fullscreen
// completely when the kAshEnableImmersiveFullscreenForAllWindows command
// line flag is set.
// completely when switches::UseImmersiveFullscreenForAllWindows() returns
// true.
window_state->set_animate_to_fullscreen(false);
}

@ -2248,12 +2248,10 @@ bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
return false;
bool is_browser_fullscreen = url.is_empty();
if (CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows)) {
if (ash::switches::UseImmersiveFullscreenForAllWindows())
return is_browser_fullscreen;
} else {
else
return is_browser_fullscreen && IsBrowserTypeNormal();
}
#else
return false;
#endif