blob: 1b06642d6e37903f523777591102a2a6e9927a1f [file] [log] [blame]
// Copyright 2021 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.
#import "ios/chrome/browser/ui/fullscreen/scoped_fullscreen_disabler.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
ScopedFullscreenDisabler::ScopedFullscreenDisabler(
FullscreenController* controller)
: scoped_observer_(this), controller_(controller) {
DCHECK(controller_);
scoped_observer_.Observe(controller);
controller_->IncrementDisabledCounter();
}
ScopedFullscreenDisabler::~ScopedFullscreenDisabler() {
if (controller_)
controller_->DecrementDisabledCounter();
}
void ScopedFullscreenDisabler::FullscreenControllerWillShutDown(
FullscreenController* controller) {
controller_ = nullptr;
}