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

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

Issue 2612293003: [MediaSession] Don't reset metadata and actions when the session goes uncontrollable (Closed)
Patch Set: rebased Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/media/session/media_session_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "content/browser/media/session/media_session_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "content/browser/media/session/audio_focus_delegate.h" 8 #include "content/browser/media/session/audio_focus_delegate.h"
9 #include "content/browser/media/session/media_session_controller.h" 9 #include "content/browser/media/session/media_session_controller.h"
10 #include "content/browser/media/session/media_session_player_observer.h" 10 #include "content/browser/media/session/media_session_player_observer.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 void MediaSessionImpl::UpdateRoutedService() { 624 void MediaSessionImpl::UpdateRoutedService() {
625 MediaSessionServiceImpl* new_service = ComputeServiceForRouting(); 625 MediaSessionServiceImpl* new_service = ComputeServiceForRouting();
626 if (new_service == routed_service_) 626 if (new_service == routed_service_)
627 return; 627 return;
628 628
629 routed_service_ = new_service; 629 routed_service_ = new_service;
630 if (routed_service_) { 630 if (routed_service_) {
631 NotifyMediaSessionMetadataChange(routed_service_->metadata()); 631 NotifyMediaSessionMetadataChange(routed_service_->metadata());
632 NotifyMediaSessionActionsChange(routed_service_->actions()); 632 NotifyMediaSessionActionsChange(routed_service_->actions());
633 } else {
634 NotifyMediaSessionMetadataChange(base::nullopt);
635 NotifyMediaSessionActionsChange(
636 std::set<blink::mojom::MediaSessionAction>());
637 } 633 }
638 } 634 }
639 635
640 MediaSessionServiceImpl* MediaSessionImpl::ComputeServiceForRouting() { 636 MediaSessionServiceImpl* MediaSessionImpl::ComputeServiceForRouting() {
641 // The service selection strategy is: select a frame that has a playing/paused 637 // The service selection strategy is: select a frame that has a playing/paused
642 // player and has a corresponding MediaSessionService and return the 638 // player and has a corresponding MediaSessionService and return the
643 // corresponding MediaSessionService. If multiple frames satisfy the criteria, 639 // corresponding MediaSessionService. If multiple frames satisfy the criteria,
644 // prefer the top-most frame. 640 // prefer the top-most frame.
645 std::set<RenderFrameHost*> frames; 641 std::set<RenderFrameHost*> frames;
646 for (const auto& player : normal_players_) { 642 for (const auto& player : normal_players_) {
(...skipping 25 matching lines...) Expand all
672 if (!IsServiceActiveForRenderFrameHost(frame)) 668 if (!IsServiceActiveForRenderFrameHost(frame))
673 continue; 669 continue;
674 best_frame = frame; 670 best_frame = frame;
675 min_depth = depth; 671 min_depth = depth;
676 } 672 }
677 673
678 return best_frame ? services_[best_frame] : nullptr; 674 return best_frame ? services_[best_frame] : nullptr;
679 } 675 }
680 676
681 } // namespace content 677 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/session/media_session_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698