Commit 876ab469 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Update for the current FS progress when BVC is shown.

BVC only listens for fullscreen progress when it's visible and active.
This CL updates BVC for the current fullscreen progress when being
shown so that any updates that occur while the BVC is not visible are
immediately reflected.

Bug: 820174
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Id9447065a30c3c8bb627afe7213cb4a623d8c5fb
Reviewed-on: https://chromium-review.googlesource.com/958484
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542846}
parent de0be310
......@@ -1255,6 +1255,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
StartBroadcastingMainContentUI(self, broadcaster);
fullscreenController->AddObserver(_fullscreenUIUpdater.get());
[self updateForFullscreenProgress:fullscreenController->GetProgress()];
} else {
StopBroadcastingToolbarUI(broadcaster);
StopBroadcastingMainContentUI(broadcaster);
......
......@@ -5,7 +5,7 @@
#ifndef IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#include "base/macros.h"
#include "components/keyed_service/core/keyed_service.h"
......@@ -52,6 +52,11 @@ class FullscreenController : public KeyedService {
virtual void IncrementDisabledCounter() = 0;
virtual void DecrementDisabledCounter() = 0;
// Returns the current fullscreen progress value. This is a float between 0.0
// and 1.0, where 0.0 denotes that the toolbar should be completely hidden and
// 1.0 denotes that the toolbar should be completely visible.
virtual CGFloat GetProgress() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(FullscreenController);
......
......@@ -29,6 +29,7 @@ class FullscreenControllerImpl : public FullscreenController {
bool IsEnabled() const override;
void IncrementDisabledCounter() override;
void DecrementDisabledCounter() override;
CGFloat GetProgress() const override;
private:
// KeyedService:
......
......@@ -83,6 +83,10 @@ void FullscreenControllerImpl::DecrementDisabledCounter() {
model_->DecrementDisabledCounter();
}
CGFloat FullscreenControllerImpl::GetProgress() const {
return model_->progress();
}
void FullscreenControllerImpl::Shutdown() {
mediator_->Disconnect();
[notification_observer_ disconnect];
......
......@@ -24,6 +24,7 @@ class TestFullscreenController : public FullscreenController {
bool IsEnabled() const override;
void IncrementDisabledCounter() override;
void DecrementDisabledCounter() override;
CGFloat GetProgress() const override;
private:
// The model.
......
......@@ -38,3 +38,7 @@ void TestFullscreenController::IncrementDisabledCounter() {
void TestFullscreenController::DecrementDisabledCounter() {
model_->DecrementDisabledCounter();
}
CGFloat TestFullscreenController::GetProgress() const {
return model_->progress();
}
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