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

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

Issue 2475473002: Implement one-shot audio focus inside MediaSession (Closed)
Patch Set: fixed a case where removing the last one-shot player Created 4 years, 1 month 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 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
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
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_impl_browsertest.cc ('k') | content/common/media/media_player_delegate_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698