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

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

Issue 2411723002: Split MediaSessionStateChanged() and MediaSessionMetadataChanged() (Closed)
Patch Set: rebased Created 4 years, 2 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // with AudioFocusManager out to a seperate class. The AudioFocusManager unit 68 // with AudioFocusManager out to a seperate class. The AudioFocusManager unit
69 // tests then could mock the interface and abandon audio focus when 69 // tests then could mock the interface and abandon audio focus when
70 // WebContents is destroyed. See https://crbug.com/651069 70 // WebContents is destroyed. See https://crbug.com/651069
71 players_.clear(); 71 players_.clear();
72 pepper_players_.clear(); 72 pepper_players_.clear();
73 AbandonSystemAudioFocusIfNeeded(); 73 AbandonSystemAudioFocusIfNeeded();
74 } 74 }
75 75
76 void MediaSession::SetMetadata(const base::Optional<MediaMetadata>& metadata) { 76 void MediaSession::SetMetadata(const base::Optional<MediaMetadata>& metadata) {
77 metadata_ = metadata; 77 metadata_ = metadata;
78 // TODO(zqzhang): On Android, the metadata is sent though JNI everytime the 78 static_cast<WebContentsImpl*>(web_contents())
79 // media session play/pause state changes. Need to find a way to seprate the 79 ->OnMediaSessionMetadataChanged();
80 // state change and Metadata update. See https://crbug.com/621855.
81 static_cast<WebContentsImpl*>(web_contents())->OnMediaSessionStateChanged();
82 } 80 }
83 81
84 bool MediaSession::AddPlayer(MediaSessionObserver* observer, 82 bool MediaSession::AddPlayer(MediaSessionObserver* observer,
85 int player_id, 83 int player_id,
86 media::MediaContentType media_content_type) { 84 media::MediaContentType media_content_type) {
87 if (media_content_type == media::MediaContentType::Pepper) 85 if (media_content_type == media::MediaContentType::Pepper)
88 return AddPepperPlayer(observer, player_id); 86 return AddPepperPlayer(observer, player_id);
89 87
90 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); 88 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier());
91 89
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 DCHECK(success); 433 DCHECK(success);
436 434
437 pepper_players_.insert(PlayerIdentifier(observer, player_id)); 435 pepper_players_.insert(PlayerIdentifier(observer, player_id));
438 436
439 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); 437 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier());
440 438
441 return true; 439 return true;
442 } 440 }
443 441
444 } // namespace content 442 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/web_contents_observer_proxy.cc ('k') | content/browser/media/session/media_session_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698