chromium/chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_PICTURE_IN_PICTURE_SCOPED_PICTURE_IN_PICTURE_OCCLUSION_OBSERVATION_H_
#define CHROME_BROWSER_PICTURE_IN_PICTURE_SCOPED_PICTURE_IN_PICTURE_OCCLUSION_OBSERVATION_H_

#include <memory>

#include "base/functional/callback.h"
#include "base/scoped_observation.h"
#include "ui/views/widget/widget_observer.h"

class PictureInPictureOcclusionObserver;
class PictureInPictureOcclusionTracker;
class PictureInPictureOcclusionTrackerObserver;

// The ScopedPictureInPictureOcclusionObservation observes the
// PictureInPictureOcclusionTracker owned by the PictureInPictureWindowManager.
// It starts observing when `Observe()` is called with a given widget and
// `occlusion_observer_` will be notified of occlusion state updates.
// `occlusion_observer_` is also synchronously notified on the call to
// `Observe()`. The ScopedPictureInPictureOcclusionObservation will stop
// observing for occlusions when EITHER:
// 1) The observed widget is destroyed, OR
// 2) The ScopedPictureInPictureOcclusionObservation itself is destroyed.
//
// See chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h
// for usage examples.
class ScopedPictureInPictureOcclusionObservation
    : public views::WidgetObserver {};

#endif  // CHROME_BROWSER_PICTURE_IN_PICTURE_SCOPED_PICTURE_IN_PICTURE_OCCLUSION_OBSERVATION_H_