1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_GLOBAL_MEDIA_CONTROLS_OVERLAY_MEDIA_NOTIFICATIONS_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_UI_GLOBAL_MEDIA_CONTROLS_OVERLAY_MEDIA_NOTIFICATIONS_MANAGER_IMPL_H_ 7 8 #include <map> 9 #include <memory> 10 #include <string> 11 12 #include "chrome/browser/ui/global_media_controls/overlay_media_notifications_manager.h" 13 14 class MediaNotificationService; 15 class OverlayMediaNotification; 16 17 // The OverlayMediaNotificationsManagerImpl owns, shows, and closes overlay 18 // media notifications. It keeps the MediaNotificationService informed of when 19 // the overlay notifications are closed. 20 class OverlayMediaNotificationsManagerImpl 21 : public OverlayMediaNotificationsManager { 22 public: 23 explicit OverlayMediaNotificationsManagerImpl( 24 MediaNotificationService* service); 25 OverlayMediaNotificationsManagerImpl( 26 const OverlayMediaNotificationsManagerImpl&) = delete; 27 OverlayMediaNotificationsManagerImpl& operator=( 28 const OverlayMediaNotificationsManagerImpl&) = delete; 29 ~OverlayMediaNotificationsManagerImpl(); 30 31 // Displays the given OverlayMediaNotification. 32 void ShowOverlayNotification( 33 const std::string& id, 34 std::unique_ptr<OverlayMediaNotification> overlay_notification); 35 36 // Closes the OverlayMediaNotification with the given |id|. 37 void CloseOverlayNotification(const std::string& id); 38 39 // OverlayMediaNotificationsManager override. 40 void OnOverlayNotificationClosed(const std::string& id) override; 41 42 private: 43 MediaNotificationService* const service_; 44 std::map<std::string, std::unique_ptr<OverlayMediaNotification>> 45 overlay_notifications_; 46 }; 47 48 #endif // CHROME_BROWSER_UI_GLOBAL_MEDIA_CONTROLS_OVERLAY_MEDIA_NOTIFICATIONS_MANAGER_IMPL_H_ 49