Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/optional.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/public/common/media_metadata.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class MediaSession; | |
| 16 class MediaSessionImpl; | |
| 17 | |
| 18 // The observer for observing MediaSession events. | |
| 19 class CONTENT_EXPORT MediaSessionObserver { | |
| 20 public: | |
| 21 // Gets the observed MediaSession. | |
| 22 MediaSession* media_session() const; | |
| 23 | |
| 24 // Called when the observed MediaSession is destroyed. | |
| 25 virtual void MediaSessionDestroyed() {} | |
|
whywhat
2016/10/24 20:29:39
This should update session_.
IMHO, it'd be more co
Zhiqiang Zhang (Slow)
2016/10/25 19:51:43
Maybe we should do reset after the method is calle
| |
| 26 | |
| 27 // Called when the observed MediaSession has changed its state. | |
| 28 virtual void MediaSessionStateChanged(bool is_controllable, | |
| 29 bool is_suspended) {} | |
| 30 | |
| 31 // Called when the observed MediaSession has changed metadata. | |
| 32 virtual void MediaSessionMetadataChanged( | |
| 33 const base::Optional<MediaMetadata>& metadata) {} | |
| 34 | |
| 35 protected: | |
| 36 // Create a MediaSessionObserver and start observing |session|. | |
| 37 explicit MediaSessionObserver(MediaSession* session); | |
| 38 | |
| 39 // Destructor of MediaSessionObserver. It will remove itself from |session| if | |
| 40 // the observer is still observing a MediaSession. | |
| 41 virtual ~MediaSessionObserver(); | |
| 42 | |
| 43 private: | |
| 44 // Weak pointer to MediaSession. | |
| 45 MediaSessionImpl* session_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_SESSION_OBSERVER_H_ | |
| OLD | NEW |