blob: 2d024adfd890f0c8ea302b7dcef1bc4e040baed2 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_FULLSCREEN_SCOPED_FULLSCREEN_DISABLER_H_
#define IOS_CHROME_BROWSER_UI_FULLSCREEN_SCOPED_FULLSCREEN_DISABLER_H_
#include "base/check.h"
#include "base/macros.h"
#include "base/scoped_observation.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller_observer.h"
// A helper object that increments FullscrenController's disabled counter for
// its entire lifetime.
class ScopedFullscreenDisabler : public FullscreenControllerObserver {
public:
explicit ScopedFullscreenDisabler(FullscreenController* controller);
~ScopedFullscreenDisabler() override;
private:
void FullscreenControllerWillShutDown(
FullscreenController* controller) override;
// Scoped observer that facilitates observing an FullscreenController.
base::ScopedObservation<FullscreenController, FullscreenControllerObserver>
scoped_observer_{this};
// The FullscreenController being disabled by this object.
FullscreenController* controller_;
DISALLOW_COPY_AND_ASSIGN(ScopedFullscreenDisabler);
};
#endif // IOS_CHROME_BROWSER_UI_FULLSCREEN_SCOPED_FULLSCREEN_DISABLER_H_