OLD | NEW |
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // show the pause button but it does not pause anything (as the routed frame | 639 // show the pause button but it does not pause anything (as the routed frame |
640 // already pauses when responding to the PAUSE action while other frames does | 640 // already pauses when responding to the PAUSE action while other frames does |
641 // not). | 641 // not). |
642 // | 642 // |
643 // TODO(zqzhang): Currently, this might not work well on desktop as Pepper and | 643 // TODO(zqzhang): Currently, this might not work well on desktop as Pepper and |
644 // OneShot players are not really suspended, so that the session is still | 644 // OneShot players are not really suspended, so that the session is still |
645 // active after this. See https://crbug.com/619084 and | 645 // active after this. See https://crbug.com/619084 and |
646 // https://crbug.com/596516. | 646 // https://crbug.com/596516. |
647 if (blink::mojom::MediaSessionAction::PAUSE == action) { | 647 if (blink::mojom::MediaSessionAction::PAUSE == action) { |
648 RenderFrameHost* rfh_of_routed_service = | 648 RenderFrameHost* rfh_of_routed_service = |
649 routed_service_->GetRenderFrameHost(); | 649 routed_service_ ? routed_service_->GetRenderFrameHost() : nullptr; |
650 for (const auto& player : normal_players_) { | 650 for (const auto& player : normal_players_) { |
651 if (player.observer->GetRenderFrameHost() != rfh_of_routed_service) | 651 if (player.observer->GetRenderFrameHost() != rfh_of_routed_service) |
652 player.observer->OnSuspend(player.player_id); | 652 player.observer->OnSuspend(player.player_id); |
653 } | 653 } |
654 for (const auto& player : pepper_players_) { | 654 for (const auto& player : pepper_players_) { |
655 if (player.observer->GetRenderFrameHost() != rfh_of_routed_service) { | 655 if (player.observer->GetRenderFrameHost() != rfh_of_routed_service) { |
656 player.observer->OnSetVolumeMultiplier(player.player_id, | 656 player.observer->OnSetVolumeMultiplier(player.player_id, |
657 kDuckingVolumeMultiplier); | 657 kDuckingVolumeMultiplier); |
658 } | 658 } |
659 } | 659 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 if (!IsServiceActiveForRenderFrameHost(frame)) | 720 if (!IsServiceActiveForRenderFrameHost(frame)) |
721 continue; | 721 continue; |
722 best_frame = frame; | 722 best_frame = frame; |
723 min_depth = depth; | 723 min_depth = depth; |
724 } | 724 } |
725 | 725 |
726 return best_frame ? services_[best_frame] : nullptr; | 726 return best_frame ? services_[best_frame] : nullptr; |
727 } | 727 } |
728 | 728 |
729 } // namespace content | 729 } // namespace content |
OLD | NEW |