Commit 45dda3e8 authored by Wei Li's avatar Wei Li Committed by Commit Bot

Don't show top UI for Kiosk mode on Mac

When the browser starts in Kiosk mode, it should enter into full screen
mode without top Chrome UI. This CL fixes this, and also re-enables a
browser test that relied on this behavior.

BUG=470724

Change-Id: Icb043b1000d29908c7f4114c327c1d7355585bd4
Reviewed-on: https://chromium-review.googlesource.com/c/1334942
Commit-Queue: Wei Li <weili@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608133}
parent 55587d34
......@@ -37,13 +37,7 @@ void ShowBubble(Browser* browser) {
}
bool HasVisibleLocationBarForBrowser(Browser* browser) {
if (!browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
return false;
if (!browser->exclusive_access_manager()->context()->IsFullscreen())
return true;
return false;
return browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
}
} // namespace
......@@ -81,10 +75,9 @@ IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, AppHasNoLocationBar) {
EXPECT_FALSE(HasVisibleLocationBarForBrowser(app_browser));
}
// http://crbug.com/470724
// Kiosk mode on Mac has a location bar but it shouldn't.
IN_PROC_BROWSER_TEST_F(PermissionBubbleKioskBrowserTest,
DISABLED_KioskHasNoLocationBar) {
KioskHasNoLocationBar) {
ShowBubble(browser());
// Kiosk mode on Mac has no location bar.
EXPECT_FALSE(HasVisibleLocationBarForBrowser(browser()));
}
......@@ -15,7 +15,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/ui_test_utils.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
TestPermissionBubbleViewDelegate::TestPermissionBubbleViewDelegate()
: PermissionPrompt::Delegate() {
......@@ -81,4 +83,8 @@ void PermissionBubbleKioskBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
PermissionBubbleBrowserTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kKioskMode);
// Navigate to a test file URL.
GURL test_file_url(ui_test_utils::GetTestUrl(
base::FilePath(), base::FilePath(FILE_PATH_LITERAL("simple.html"))));
command_line->AppendArg(test_file_url.spec());
}
......@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h"
......@@ -19,6 +20,7 @@
#include "chrome/browser/ui/views/frame/browser_view_layout.h"
#include "chrome/browser/ui/views/frame/hosted_app_button_container.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "ui/base/hit_test.h"
......@@ -32,6 +34,9 @@ constexpr int kFramePaddingLeft = 75;
FullscreenToolbarStyle GetUserPreferredToolbarStyle(
const PrefService* pref_service) {
// In Kiosk mode, we don't show top Chrome UI.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
return FullscreenToolbarStyle::TOOLBAR_NONE;
return pref_service->GetBoolean(prefs::kShowFullscreenToolbar)
? FullscreenToolbarStyle::TOOLBAR_PRESENT
: FullscreenToolbarStyle::TOOLBAR_HIDDEN;
......
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