chromium/content/browser/media/media_keys_listener_manager_impl.h

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

#ifndef CONTENT_BROWSER_MEDIA_MEDIA_KEYS_LISTENER_MANAGER_IMPL_H_
#define CONTENT_BROWSER_MEDIA_MEDIA_KEYS_LISTENER_MANAGER_IMPL_H_

#include <memory>
#include <set>
#include <utility>

#include "base/containers/flat_map.h"
#include "base/observer_list.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "components/system_media_controls/system_media_controls_observer.h"
#include "content/public/browser/media_keys_listener_manager.h"
#include "ui/base/accelerators/media_keys_listener.h"
#include "ui/events/keycodes/keyboard_codes.h"

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#define USE_INSTANCED_SYSTEM_MEDIA_CONTROLS_FOR_WEB_APPS
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)

namespace system_media_controls {
class SystemMediaControls;
}  // namespace system_media_controls

namespace content {

class ActiveMediaSessionController;
class SystemMediaControlsNotifier;

#if USE_INSTANCED_SYSTEM_MEDIA_CONTROLS_FOR_WEB_APPS
class WebAppSystemMediaControlsManager;
enum class WebAppSystemMediaControlsEvent;
#endif  // USE_INSTANCED_SYSTEM_MEDIA_CONTROLS_FOR_WEB_APPS

class MediaKeysListenerManagerImplTestObserver {};

// Listens for media keys and decides which listeners receive which events. In
// particular, it owns one of its delegates (ActiveMediaSessionController), and
// only propagates to the ActiveMediaSessionController if no other delegates are
// listening to a particular media key.

// It also owns the WebAppSystemMediaControlsManager which it retrieves
// information from and propagates to if no other delegates are listening to a
// particular media key. See WebAppSystemMediaControlsManager for more
// information on that class' responsibilities.
class MediaKeysListenerManagerImpl
    : public MediaKeysListenerManager,
      public ui::MediaKeysListener::Delegate,
      public system_media_controls::SystemMediaControlsObserver {};

}  // namespace content

#endif  // CONTENT_BROWSER_MEDIA_MEDIA_KEYS_LISTENER_MANAGER_IMPL_H_