| 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/common/content_export.h" | 
 |  11 #include "content/public/common/media_metadata.h" | 
 |  12  | 
 |  13 namespace content { | 
 |  14  | 
 |  15 class MediaSession; | 
 |  16  | 
 |  17 // The observer for MediaSession events. | 
 |  18 class CONTENT_EXPORT MediaSessionObserver { | 
 |  19  public: | 
 |  20   // Create a MediaSessionObserver and start observing |session|. | 
 |  21   explicit MediaSessionObserver(MediaSession* session); | 
 |  22   // Destructor of MediaSessionObserver. It will remove itself from |session| if | 
 |  23   // the observer is still observing a MediaSession. | 
 |  24   virtual ~MediaSessionObserver(); | 
 |  25  | 
 |  26   // Gets the observed MediaSession. | 
 |  27   MediaSession* session() { return session_; } | 
 |  28  | 
 |  29   // Called when the observed MediaSession is destroyed. | 
 |  30   virtual void MediaSessionDestroyed() {} | 
 |  31  | 
 |  32   // Called when the observed MediaSession has changed its state. | 
 |  33   virtual void MediaSessionStateChanged(bool is_controllable, | 
 |  34                                         bool is_suspended) {} | 
 |  35  | 
 |  36   // Called when the observed MediaSession has changed metadata. | 
 |  37   virtual void MediaSessionMetadataChanged( | 
 |  38       const base::Optional<MediaMetadata>& metadata) {} | 
 |  39  | 
 |  40  private: | 
 |  41   // Weak pointer to MediaSession. | 
 |  42   MediaSession* session_; | 
 |  43  | 
 |  44   DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver); | 
 |  45 }; | 
 |  46  | 
 |  47 }  // namespace content | 
 |  48  | 
 |  49 #endif  // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_OBSERVER_H_ | 
| OLD | NEW |