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[] = const char kAshEnableImmersiveFullscreenForAllWindows[] =
"ash-enable-immersive-all-windows"; "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) #if defined(OS_CHROMEOS)
// Enables the "full multi profile mode" - as it was in M-31. // Enables the "full multi profile mode" - as it was in M-31.
const char kAshEnableFullMultiProfileMode[] = const char kAshEnableFullMultiProfileMode[] =
@@ -225,6 +230,11 @@ bool UseDragOffShelf() {
HasSwitch(kAshDisableDragOffShelf); HasSwitch(kAshDisableDragOffShelf);
} }
bool UseImmersiveFullscreenForAllWindows() {
return !CommandLine::ForCurrentProcess()->HasSwitch(
kAshEnableImmersiveFullscreenForBrowserOnly);
}
bool ShowShelfAlignmentMenu() { bool ShowShelfAlignmentMenu() {
return !CommandLine::ForCurrentProcess()-> return !CommandLine::ForCurrentProcess()->
HasSwitch(kHideShelfAlignmentMenu); HasSwitch(kHideShelfAlignmentMenu);

@@ -44,6 +44,7 @@ ASH_EXPORT extern const char kAshEnableAdvancedGestures[];
ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[]; ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[];
ASH_EXPORT extern const char kAshEnableBrightnessControl[]; ASH_EXPORT extern const char kAshEnableBrightnessControl[];
ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForAllWindows[]; ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForAllWindows[];
ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForBrowserOnly[];
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
ASH_EXPORT extern const char kAshEnableFullMultiProfileMode[]; ASH_EXPORT extern const char kAshEnableFullMultiProfileMode[];
#endif #endif
@@ -86,6 +87,10 @@ ASH_EXPORT bool UseAlternateShelfLayout();
// Returns true if items can be dragged off the shelf to unpin. // Returns true if items can be dragged off the shelf to unpin.
ASH_EXPORT bool UseDragOffShelf(); 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. // Returns true if side shelf alignment is enabled.
ASH_EXPORT bool ShowShelfAlignmentMenu(); ASH_EXPORT bool ShowShelfAlignmentMenu();

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

@@ -43,12 +43,11 @@ WindowState::WindowState(aura::Window* window)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// NOTE(pkotwicz): Animating to immersive fullscreen does not look good. When // 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 // 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 // to only animate to fullscreen if the window is put into immersive
// fullscreen. // fullscreen.
animate_to_fullscreen_ = !CommandLine::ForCurrentProcess()->HasSwitch( animate_to_fullscreen_ = !switches::UseImmersiveFullscreenForAllWindows();
switches::kAshEnableImmersiveFullscreenForAllWindows);
#endif #endif
} }

@@ -1017,11 +1017,13 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(ash::switches::kAshDisableDockedWindows) 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_NAME,
IDS_FLAGS_IMMERSIVE_FULLSCREEN_FOR_ALL_WINDOWS_DESCRIPTION, IDS_FLAGS_IMMERSIVE_FULLSCREEN_FOR_ALL_WINDOWS_DESCRIPTION,
kOsCrOS, kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kAshEnableImmersiveFullscreenForAllWindows) ENABLE_DISABLE_VALUE_TYPE(
ash::switches::kAshEnableImmersiveFullscreenForAllWindows,
ash::switches::kAshEnableImmersiveFullscreenForBrowserOnly)
}, },
#endif #endif
{ {

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

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

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

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