Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: content/browser/media/session/media_session_observer.h

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 add itself to observe |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 MediaSession this observer is observing.
27 MediaSession* session() { return session_; }
28
29 // Called when this observer is disconnected from |session_|.
30 virtual void MediaSessionDisconnected();
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 void Observe(MediaSession* session);
42
43 // Weak pointer to MediaSession, this class is owned by MediaSession.
44 MediaSession* session_;
45
46 DISALLOW_COPY_AND_ASSIGN(MediaSessionObserver);
47 };
48
49 } // namespace content
50
51 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698