Commit 1a1af6ef authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[Fullscreen Exit] Implement the experiment flag as a base::Feature

We're about to launch the fullscreen exit UI, starting at 100% for Dev and
Canary. Currently the flag for fullscreen exit UI is implemented as a
command line switch, which can't be used with Finch experiment. This CL
makes the flag base::Feature so that it can be controlled by experiment.

Bug: 829606
Change-Id: I955439a4cf6cdd6196fa6d9d42faaebabbc373b0
Reviewed-on: https://chromium-review.googlesource.com/1008724
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550086}
parent 4da682b0
...@@ -3336,7 +3336,7 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -3336,7 +3336,7 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kExperimentalFullscreenExitUIName, flag_descriptions::kExperimentalFullscreenExitUIName,
flag_descriptions::kExperimentalFullscreenExitUIDescription, flag_descriptions::kExperimentalFullscreenExitUIDescription,
kOsWin | kOsLinux | kOsCrOS, kOsWin | kOsLinux | kOsCrOS,
SINGLE_VALUE_TYPE(switches::kEnableExperimentalFullscreenExitUI)}, FEATURE_VALUE_TYPE(features::kFullscreenExitUI)},
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)
{"network-service", flag_descriptions::kEnableNetworkServiceName, {"network-service", flag_descriptions::kEnableNetworkServiceName,
......
...@@ -2027,8 +2027,7 @@ void BrowserView::ViewHierarchyChanged( ...@@ -2027,8 +2027,7 @@ void BrowserView::ViewHierarchyChanged(
#if defined(USE_AURA) #if defined(USE_AURA)
if (init) { if (init) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (FullscreenControlHost::IsFullscreenExitUIEnabled()) {
switches::kEnableExperimentalFullscreenExitUI)) {
widget->GetNativeView()->AddPreTargetHandler(GetFullscreenControlHost()); widget->GetNativeView()->AddPreTargetHandler(GetFullscreenControlHost());
} }
} else if (fullscreen_control_host_) { } else if (fullscreen_control_host_) {
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "base/bind.h" #include "base/bind.h"
#include "build/build_config.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h" #include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "chrome/common/chrome_features.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -54,6 +56,17 @@ FullscreenControlHost::FullscreenControlHost(BrowserView* browser_view, ...@@ -54,6 +56,17 @@ FullscreenControlHost::FullscreenControlHost(BrowserView* browser_view,
FullscreenControlHost::~FullscreenControlHost() = default; FullscreenControlHost::~FullscreenControlHost() = default;
// static
bool FullscreenControlHost::IsFullscreenExitUIEnabled() {
#if defined(OS_MACOSX)
// Exit UI is unnecessary, since Mac reveals the top chrome when the cursor
// moves to the top of the screen.
return false;
#else
return base::FeatureList::IsEnabled(features::kFullscreenExitUI);
#endif
}
void FullscreenControlHost::OnMouseEvent(ui::MouseEvent* event) { void FullscreenControlHost::OnMouseEvent(ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSE_MOVED || if (event->type() != ui::ET_MOUSE_MOVED ||
fullscreen_control_popup_.IsAnimating() || fullscreen_control_popup_.IsAnimating() ||
......
...@@ -30,6 +30,8 @@ class FullscreenControlHost : public ui::EventHandler { ...@@ -30,6 +30,8 @@ class FullscreenControlHost : public ui::EventHandler {
views::View* host_view); views::View* host_view);
~FullscreenControlHost() override; ~FullscreenControlHost() override;
static bool IsFullscreenExitUIEnabled();
// ui::EventHandler: // ui::EventHandler:
void OnMouseEvent(ui::MouseEvent* event) override; void OnMouseEvent(ui::MouseEvent* event) override;
void OnTouchEvent(ui::TouchEvent* event) override; void OnTouchEvent(ui::TouchEvent* event) override;
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -22,8 +22,9 @@ class FullscreenControlViewTest : public InProcessBrowserTest { ...@@ -22,8 +22,9 @@ class FullscreenControlViewTest : public InProcessBrowserTest {
public: public:
FullscreenControlViewTest() = default; FullscreenControlViewTest() = default;
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUp() override {
command_line->AppendSwitch(switches::kEnableExperimentalFullscreenExitUI); scoped_feature_list_.InitAndEnableFeature(features::kFullscreenExitUI);
InProcessBrowserTest::SetUp();
} }
protected: protected:
...@@ -42,6 +43,8 @@ class FullscreenControlViewTest : public InProcessBrowserTest { ...@@ -42,6 +43,8 @@ class FullscreenControlViewTest : public InProcessBrowserTest {
} }
private: private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(FullscreenControlViewTest); DISALLOW_COPY_AND_ASSIGN(FullscreenControlViewTest);
}; };
......
...@@ -276,6 +276,11 @@ const base::Feature kOpenVR{"OpenVR", base::FEATURE_DISABLED_BY_DEFAULT}; ...@@ -276,6 +276,11 @@ const base::Feature kOpenVR{"OpenVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // BUILDFLAG(ENABLE_VR) #endif // BUILDFLAG(ENABLE_VR)
// Enables a floating action button-like full screen exit UI to allow exiting
// fullscreen using mouse or touch.
const base::Feature kFullscreenExitUI{"FullscreenExitUI",
base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_WIN) #if defined(OS_WIN)
// Enables using GDI to print text as simply text. // Enables using GDI to print text as simply text.
const base::Feature kGdiTextPrinting {"GdiTextPrinting", const base::Feature kGdiTextPrinting {"GdiTextPrinting",
......
...@@ -153,6 +153,8 @@ extern const base::Feature kOpenVR; ...@@ -153,6 +153,8 @@ extern const base::Feature kOpenVR;
#endif // ENABLE_VR #endif // ENABLE_VR
extern const base::Feature kFullscreenExitUI;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
extern const base::Feature kFullscreenToolbarReveal; extern const base::Feature kFullscreenToolbarReveal;
#endif #endif
......
...@@ -295,11 +295,6 @@ const char kEnableDevToolsExperiments[] = "enable-devtools-experiments"; ...@@ -295,11 +295,6 @@ const char kEnableDevToolsExperiments[] = "enable-devtools-experiments";
// Enables Domain Reliability Monitoring. // Enables Domain Reliability Monitoring.
const char kEnableDomainReliability[] = "enable-domain-reliability"; const char kEnableDomainReliability[] = "enable-domain-reliability";
// Enables an experimental full screen exit UI to allow exiting fullscreen from
// mouse or touch.
const char kEnableExperimentalFullscreenExitUI[] =
"enable-experimental-fullscreen-exit-ui";
// Enables logging for extension activity. // Enables logging for extension activity.
const char kEnableExtensionActivityLogging[] = const char kEnableExtensionActivityLogging[] =
"enable-extension-activity-logging"; "enable-extension-activity-logging";
......
...@@ -97,7 +97,6 @@ extern const char kEnableCloudPrintProxy[]; ...@@ -97,7 +97,6 @@ extern const char kEnableCloudPrintProxy[];
extern const char kEnableDeviceDiscoveryNotifications[]; extern const char kEnableDeviceDiscoveryNotifications[];
extern const char kEnableDevToolsExperiments[]; extern const char kEnableDevToolsExperiments[];
extern const char kEnableDomainReliability[]; extern const char kEnableDomainReliability[];
extern const char kEnableExperimentalFullscreenExitUI[];
extern const char kEnableExtensionActivityLogging[]; extern const char kEnableExtensionActivityLogging[];
extern const char kEnableExtensionActivityLogTesting[]; extern const char kEnableExtensionActivityLogTesting[];
extern const char kEnableFastUnload[]; extern const char kEnableFastUnload[];
......
...@@ -26178,6 +26178,7 @@ from previous Chrome versions. ...@@ -26178,6 +26178,7 @@ from previous Chrome versions.
<int value="-1633586675" label="TabModalJsDialog:enabled"/> <int value="-1633586675" label="TabModalJsDialog:enabled"/>
<int value="-1631329950" label="ssl-version-max"/> <int value="-1631329950" label="ssl-version-max"/>
<int value="-1630419335" label="enable-download-notification"/> <int value="-1630419335" label="enable-download-notification"/>
<int value="-1625881240" label="FullscreenExitUI:disabled"/>
<int value="-1624854957" label="enable-es3-apis"/> <int value="-1624854957" label="enable-es3-apis"/>
<int value="-1620804800" label="NoScriptPreviews:disabled"/> <int value="-1620804800" label="NoScriptPreviews:disabled"/>
<int value="-1620568042" label="FeaturePolicy:disabled"/> <int value="-1620568042" label="FeaturePolicy:disabled"/>
...@@ -27143,6 +27144,7 @@ from previous Chrome versions. ...@@ -27143,6 +27144,7 @@ from previous Chrome versions.
<int value="679931272" label="DcheckIsFatal:enabled"/> <int value="679931272" label="DcheckIsFatal:enabled"/>
<int value="680070635" <int value="680070635"
label="enable-fullscreen-handwriting-virtual-keyboard:disabled"/> label="enable-fullscreen-handwriting-virtual-keyboard:disabled"/>
<int value="681622885" label="FullscreenExitUI:enabled"/>
<int value="682549212" label="ash-enable-cursor-motion-blur"/> <int value="682549212" label="ash-enable-cursor-motion-blur"/>
<int value="684806628" label="TranslateLanguageByULP:disabled"/> <int value="684806628" label="TranslateLanguageByULP:disabled"/>
<int value="685916283" label="enable-zip-archiver-on-file-manager"/> <int value="685916283" label="enable-zip-archiver-on-file-manager"/>
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