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_BROWSER_MEDIA_SESSION_MEDIA_SESSION_OBSERVER_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/optional.h" | |
| 10 #include "content/public/common/media_metadata.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class MediaSession; | |
| 15 | |
| 16 class MediaSessionObserver { | |
| 17 public: | |
| 18 explicit MediaSessionObserver(MediaSession* session); | |
| 19 virtual ~MediaSessionObserver() = default; | |
|
whywhat
2016/10/20 15:38:33
if you "unobserve" in dtor, you can probably remov
Zhiqiang Zhang (Slow)
2016/10/20 16:22:32
Yes. It is now in the new patch.
| |
| 20 | |
| 21 MediaSession* session() { return session_; } | |
| 22 | |
| 23 virtual void MediaSessionDisconnected() {} | |
| 24 | |
| 25 virtual void MediaSessionStateChanged( | |
| 26 bool is_controllable, bool is_suspended) {} | |
| 27 | |
| 28 virtual void MediaSessionMetadataChanged( | |
| 29 const base::Optional<MediaMetadata>& metadata) {} | |
| 30 | |
| 31 private: | |
| 32 void Observe(MediaSession* session); | |
| 33 | |
| 34 // Weak pointer to MediaSession, this class is owned by MediaSession. | |
| 35 MediaSession* session_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); | |
| 38 }; | |
| 39 | |
| 40 } // namespace content | |
| 41 | |
| 42 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_OBSERVER_H_ | |
| OLD | NEW |