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

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

Issue 2428873002: Add about_flag for experimenting MediaSession on Desktop (Closed)
Patch Set: 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 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.h" 9 #include "content/browser/media/session/media_session.h"
10 #include "content/browser/media/session/pepper_player_delegate.h" 10 #include "content/browser/media/session/pepper_player_delegate.h"
(...skipping 28 matching lines...) Expand all
39 UMA_HISTOGRAM_BOOLEAN("Media.Pepper.PlayedSound", 39 UMA_HISTOGRAM_BOOLEAN("Media.Pepper.PlayedSound",
40 players_played_sound_map_[pp_instance]); 40 players_played_sound_map_[pp_instance]);
41 players_played_sound_map_.erase(pp_instance); 41 players_played_sound_map_.erase(pp_instance);
42 42
43 PepperStopsPlayback(pp_instance); 43 PepperStopsPlayback(pp_instance);
44 } 44 }
45 45
46 void PepperPlaybackObserver::PepperStartsPlayback(int32_t pp_instance) { 46 void PepperPlaybackObserver::PepperStartsPlayback(int32_t pp_instance) {
47 players_played_sound_map_[pp_instance] = true; 47 players_played_sound_map_[pp_instance] = true;
48 48
49 if (!base::FeatureList::IsEnabled(media::kFlashJoinsMediaSession)) 49 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
Alexei Svitkine (slow) 2016/10/18 16:31:32 If you do end up going with the flag, rather than
Zhiqiang Zhang (Slow) 2016/10/18 16:46:26 Done.
50 switches::kEnableDefaultMediaSession) !=
51 switches::kEnableDefaultMediaSessionWithFlash) {
50 return; 52 return;
53 }
51 54
52 if (players_map_.count(pp_instance)) 55 if (players_map_.count(pp_instance))
53 return; 56 return;
54 57
55 players_map_[pp_instance].reset(new PepperPlayerDelegate( 58 players_map_[pp_instance].reset(new PepperPlayerDelegate(
56 contents_, pp_instance)); 59 contents_, pp_instance));
57 MediaSession::Get(contents_)->AddPlayer( 60 MediaSession::Get(contents_)->AddPlayer(
58 players_map_[pp_instance].get(), 61 players_map_[pp_instance].get(),
59 PepperPlayerDelegate::kPlayerId, 62 PepperPlayerDelegate::kPlayerId,
60 media::MediaContentType::Pepper); 63 media::MediaContentType::Pepper);
61 } 64 }
62 65
63 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { 66 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) {
64 if (!players_map_.count(pp_instance)) 67 if (!players_map_.count(pp_instance))
65 return; 68 return;
66 69
67 MediaSession::Get(contents_)->RemovePlayer( 70 MediaSession::Get(contents_)->RemovePlayer(
68 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); 71 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId);
69 72
70 players_map_.erase(pp_instance); 73 players_map_.erase(pp_instance);
71 } 74 }
72 75
73 } // namespace content 76 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698