Commit 1bdd9255 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Add flag to disable hiding the bottom toolbar for fullscreen.

Bug: 961449
Change-Id: Ia45b11b8976f4fa7fb98bb4cd7451d2737027365
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1603525Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658300}
parent ee317387
......@@ -583,6 +583,9 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
{"language-settings", flag_descriptions::kLanguageSettingsName,
flag_descriptions::kLanguageSettingsDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kLanguageSettings)},
{"lock-bottom-toolbar", flag_descriptions::kLockBottomToolbarName,
flag_descriptions::kLockBottomToolbarDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(fullscreen::features::kLockBottomToolbar)},
};
// Add all switches from experimental flags to |command_line|.
......
......@@ -294,6 +294,11 @@ const char kLanguageSettingsDescription[] =
"Enables the Language Settings page allowing modifications to user "
"preferred languages and translate preferences.";
const char kLockBottomToolbarName[] = "Lock bottom toolbar";
const char kLockBottomToolbarDescription[] =
"When enabled, the bottom toolbar will not get collapsed when scrolling "
"into fullscreen mode.";
const char kMarkHttpAsName[] = "Mark non-secure origins as non-secure";
const char kMarkHttpAsDescription[] = "Change the UI treatment for HTTP pages";
......
......@@ -240,6 +240,10 @@ extern const char kInProductHelpDemoModeDescription[];
extern const char kLanguageSettingsName[];
extern const char kLanguageSettingsDescription[];
// Title and description for the flag to lock the bottom toolbar into place.
extern const char kLockBottomToolbarName[];
extern const char kLockBottomToolbarDescription[];
// Title, description, and options for the MarkHttpAs setting that controls
// display of omnibox warnings about non-secure pages.
extern const char kMarkHttpAsName[];
......
......@@ -3749,6 +3749,10 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// Translates the footer view up and down according to |progress|, where a
// progress of 1.0 fully shows the footer and a progress of 0.0 fully hides it.
- (void)updateFootersForFullscreenProgress:(CGFloat)progress {
// If the bottom toolbar is locked into place, reset |progress| to 1.0.
if (base::FeatureList::IsEnabled(fullscreen::features::kLockBottomToolbar))
progress = 1.0;
self.footerFullscreenProgress = progress;
CGFloat height = 0.0;
......@@ -3790,8 +3794,13 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// safe area, so the unsafe top height must be added.
CGFloat top = AlignValueToPixel(
self.headerHeight + (progress - 1.0) * [self nonFullscreenToolbarHeight]);
CGFloat bottom =
AlignValueToPixel(progress * [self secondaryToolbarHeightWithInset]);
// If the bottom toolbar is locked into place, use 1.0 instead of |progress|.
CGFloat bottomProgress =
base::FeatureList::IsEnabled(fullscreen::features::kLockBottomToolbar)
? 1.0
: progress;
CGFloat bottom = AlignValueToPixel(bottomProgress *
[self secondaryToolbarHeightWithInset]);
if (self.usesSafeInsetsForViewportAdjustments) {
if (fullscreen::features::GetActiveViewportExperiment() ==
......
......@@ -5,6 +5,7 @@
#ifndef IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_FEATURES_H_
#define IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_FEATURES_H_
#include "base/feature_list.h"
#include "components/flags_ui/feature_entry.h"
namespace fullscreen {
......@@ -36,6 +37,10 @@ enum class ViewportAdjustmentExperiment : short {
// from the command line.
ViewportAdjustmentExperiment GetActiveViewportExperiment();
// Used to control whether the bottom toolbar should be locked into the extended
// position (i.e. fullscreen progress == 1.0).
extern const base::Feature kLockBottomToolbar;
} // namespace features
} // namespace fullscreen
......
......@@ -66,5 +66,8 @@ ViewportAdjustmentExperiment GetActiveViewportExperiment() {
: ViewportAdjustmentExperiment::FRAME;
}
const base::Feature kLockBottomToolbar{"LockBottomToolbar",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace fullscreen
......@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/observer_list.h"
#import "ios/chrome/browser/ui/broadcaster/chrome_broadcast_observer_bridge.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
#import "ios/chrome/browser/ui/fullscreen/scoped_fullscreen_disabler.h"
class FullscreenModelObserver;
......@@ -72,10 +73,14 @@ class FullscreenModel : public ChromeBroadcastObserverInterface {
// Returns the toolbar insets at |progress|.
UIEdgeInsets GetToolbarInsetsAtProgress(CGFloat progress) const {
const CGFloat kBottomToolbarProgress =
base::FeatureList::IsEnabled(fullscreen::features::kLockBottomToolbar)
? 1.0
: progress;
return UIEdgeInsetsMake(
collapsed_toolbar_height_ +
progress * (expanded_toolbar_height_ - collapsed_toolbar_height_),
0, progress * bottom_toolbar_height_, 0);
0, kBottomToolbarProgress * bottom_toolbar_height_, 0);
}
// Increments and decrements |disabled_counter_| for features that require the
......
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