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

Side by Side Diff: content/browser/media/session/media_session.cc

Issue 2015433003: Implement MediaMetadata artwork in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Mounir's comments Created 4 years, 5 months 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/session/media_session.h" 5 #include "content/browser/media/session/media_session.h"
6 6
7 #include "content/browser/media/session/media_session_delegate.h" 7 #include "content/browser/media/session/media_session_delegate.h"
8 #include "content/browser/media/session/media_session_observer.h" 8 #include "content/browser/media/session/media_session_observer.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 session->Initialize(); 51 session->Initialize();
52 } 52 }
53 return session; 53 return session;
54 } 54 }
55 55
56 MediaSession::~MediaSession() { 56 MediaSession::~MediaSession() {
57 DCHECK(players_.empty()); 57 DCHECK(players_.empty());
58 DCHECK(audio_focus_state_ == State::INACTIVE); 58 DCHECK(audio_focus_state_ == State::INACTIVE);
59 } 59 }
60 60
61 void MediaSession::SetMetadata(const MediaMetadata& metadata) {
62 metadata_ = metadata;
63 static_cast<WebContentsImpl*>(web_contents())->OnMediaSessionStateChanged();
64 }
65
61 bool MediaSession::AddPlayer(MediaSessionObserver* observer, 66 bool MediaSession::AddPlayer(MediaSessionObserver* observer,
62 int player_id, 67 int player_id,
63 Type type) { 68 Type type) {
64 observer->OnSetVolumeMultiplier(player_id, volume_multiplier_); 69 observer->OnSetVolumeMultiplier(player_id, volume_multiplier_);
65 70
66 // If the audio focus is already granted and is of type Content, there is 71 // If the audio focus is already granted and is of type Content, there is
67 // nothing to do. If it is granted of type Transient the requested type is 72 // nothing to do. If it is granted of type Transient the requested type is
68 // also transient, there is also nothing to do. Otherwise, the session needs 73 // also transient, there is also nothing to do. Otherwise, the session needs
69 // to request audio focus again. 74 // to request audio focus again.
70 if (audio_focus_state_ == State::ACTIVE && 75 if (audio_focus_state_ == State::ACTIVE &&
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 case State::SUSPENDED: 344 case State::SUSPENDED:
340 uma_helper_.OnSessionSuspended(); 345 uma_helper_.OnSessionSuspended();
341 break; 346 break;
342 case State::INACTIVE: 347 case State::INACTIVE:
343 uma_helper_.OnSessionInactive(); 348 uma_helper_.OnSessionInactive();
344 break; 349 break;
345 } 350 }
346 } 351 }
347 352
348 } // namespace content 353 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698