Commit 345d8680 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Use immersive for apps only in fullscreen state.

Looks like I misunderstood the comment when I refactored.

BUG=843856
TEST=covered by unittest

Change-Id: I6fb735472af25e833ef2a40f99bd0a26867da3fb
Reviewed-on: https://chromium-review.googlesource.com/1107214Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568743}
parent e2cac39f
...@@ -584,8 +584,8 @@ bool ChromeNativeAppWindowViewsAuraAsh::ShouldEnableImmersiveMode() const { ...@@ -584,8 +584,8 @@ bool ChromeNativeAppWindowViewsAuraAsh::ShouldEnableImmersiveMode() const {
if (app_window()->IsForcedFullscreen()) if (app_window()->IsForcedFullscreen())
return false; return false;
// Always use immersive mode in a public session. // Always use immersive mode in a public session in fullscreen state.
if (profiles::IsPublicSession()) if (profiles::IsPublicSession() && IsFullscreen())
return true; return true;
// Always use immersive mode when fullscreen is set by the OS. // Always use immersive mode when fullscreen is set by the OS.
......
...@@ -127,6 +127,8 @@ class ChromeNativeAppWindowViewsAuraAsh ...@@ -127,6 +127,8 @@ class ChromeNativeAppWindowViewsAuraAsh
ImmersiveModeFullscreenRestoreType); ImmersiveModeFullscreenRestoreType);
FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshBrowserTest, FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshBrowserTest,
NoImmersiveModeWhenForcedFullscreen); NoImmersiveModeWhenForcedFullscreen);
FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshBrowserTest,
PublicSessionImmersiveMode);
FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshInteractiveTest, FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshInteractiveTest,
NoImmersiveOrBubbleOutsidePublicSessionWindow); NoImmersiveOrBubbleOutsidePublicSessionWindow);
FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshInteractiveTest, FRIEND_TEST_ALL_PREFIXES(ChromeNativeAppWindowViewsAuraAshInteractiveTest,
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
#include "chromeos/login/login_state.h"
class ChromeNativeAppWindowViewsAuraAshBrowserTest class ChromeNativeAppWindowViewsAuraAshBrowserTest
: public extensions::PlatformAppBrowserTest { : public extensions::PlatformAppBrowserTest {
public: public:
...@@ -145,3 +147,24 @@ IN_PROC_BROWSER_TEST_F(ChromeNativeAppWindowViewsAuraAshBrowserTest, ...@@ -145,3 +147,24 @@ IN_PROC_BROWSER_TEST_F(ChromeNativeAppWindowViewsAuraAshBrowserTest,
tablet_mode_controller->FlushForTesting(); tablet_mode_controller->FlushForTesting();
EXPECT_FALSE(window->immersive_fullscreen_controller_->IsEnabled()); EXPECT_FALSE(window->immersive_fullscreen_controller_->IsEnabled());
} }
// Make sure a normal window is not in immersive mode, and uses
// immersive in fullscreen.
IN_PROC_BROWSER_TEST_F(ChromeNativeAppWindowViewsAuraAshBrowserTest,
PublicSessionImmersiveMode) {
chromeos::LoginState::Get()->SetLoggedInState(
chromeos::LoginState::LOGGED_IN_ACTIVE,
chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT);
extensions::AppWindow* app_window = CreateTestAppWindow("{}");
auto* window = static_cast<ChromeNativeAppWindowViewsAuraAsh*>(
GetNativeAppWindowForAppWindow(app_window));
ASSERT_TRUE(window != nullptr);
ASSERT_TRUE(window->immersive_fullscreen_controller_.get() != nullptr);
EXPECT_FALSE(window->immersive_fullscreen_controller_->IsEnabled());
app_window->SetFullscreen(extensions::AppWindow::FULLSCREEN_TYPE_HTML_API,
true);
EXPECT_TRUE(window->immersive_fullscreen_controller_->IsEnabled());
}
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