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

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 dcheng'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 // TODO(zqzhang): On Android, the metadata is sent though JNI everytime the
64 // media session play/pause state changes. Need to find a way to seprate the
65 // state change and Metadata update. See https://crbug.com/621855.
66 static_cast<WebContentsImpl*>(web_contents())->OnMediaSessionStateChanged();
67 }
68
61 bool MediaSession::AddPlayer(MediaSessionObserver* observer, 69 bool MediaSession::AddPlayer(MediaSessionObserver* observer,
62 int player_id, 70 int player_id,
63 Type type) { 71 Type type) {
64 observer->OnSetVolumeMultiplier(player_id, volume_multiplier_); 72 observer->OnSetVolumeMultiplier(player_id, volume_multiplier_);
65 73
66 // If the audio focus is already granted and is of type Content, there is 74 // 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 75 // 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 76 // also transient, there is also nothing to do. Otherwise, the session needs
69 // to request audio focus again. 77 // to request audio focus again.
70 if (audio_focus_state_ == State::ACTIVE && 78 if (audio_focus_state_ == State::ACTIVE &&
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 case State::SUSPENDED: 347 case State::SUSPENDED:
340 uma_helper_.OnSessionSuspended(); 348 uma_helper_.OnSessionSuspended();
341 break; 349 break;
342 case State::INACTIVE: 350 case State::INACTIVE:
343 uma_helper_.OnSessionInactive(); 351 uma_helper_.OnSessionInactive();
344 break; 352 break;
345 } 353 }
346 } 354 }
347 355
348 } // namespace content 356 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698