OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/pepper_playback_observer.h" | 5 #include "content/browser/media/session/pepper_playback_observer.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "content/browser/media/session/media_session_impl.h" | 9 #include "content/browser/media/session/media_session_impl.h" |
10 #include "content/browser/media/session/pepper_player_delegate.h" | 10 #include "content/browser/media/session/pepper_player_delegate.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 if (players_map_.count(pp_instance)) | 59 if (players_map_.count(pp_instance)) |
60 return; | 60 return; |
61 | 61 |
62 players_map_[pp_instance].reset(new PepperPlayerDelegate( | 62 players_map_[pp_instance].reset(new PepperPlayerDelegate( |
63 contents_, pp_instance)); | 63 contents_, pp_instance)); |
64 | 64 |
65 MediaSessionImpl::Get(contents_)->AddPlayer( | 65 MediaSessionImpl::Get(contents_)->AddPlayer( |
66 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId, | 66 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId, |
67 ShouldDuckFlash() ? media::MediaContentType::Pepper | 67 ShouldDuckFlash() ? media::MediaContentType::Pepper |
68 : media::MediaContentType::Persistent); | 68 : media::MediaContentType::OneShot); |
69 } | 69 } |
70 | 70 |
71 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { | 71 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { |
72 if (!players_map_.count(pp_instance)) | 72 if (!players_map_.count(pp_instance)) |
73 return; | 73 return; |
74 | 74 |
75 MediaSessionImpl::Get(contents_)->RemovePlayer( | 75 MediaSessionImpl::Get(contents_)->RemovePlayer( |
76 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); | 76 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); |
77 | 77 |
78 players_map_.erase(pp_instance); | 78 players_map_.erase(pp_instance); |
79 } | 79 } |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
OLD | NEW |