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

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

Issue 1996043002: Split MediaContentType and AudioFocusType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Mounir's comments Created 4 years, 4 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"
11 #include "content/common/frame_messages.h" 11 #include "content/common/frame_messages.h"
12 #include "ipc/ipc_message_macros.h" 12 #include "ipc/ipc_message_macros.h"
13 #include "media/base/media_content_type.h"
13 #include "media/base/media_switches.h" 14 #include "media/base/media_switches.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 PepperPlaybackObserver::PepperPlaybackObserver(WebContentsImpl *contents) 18 PepperPlaybackObserver::PepperPlaybackObserver(WebContentsImpl *contents)
18 : contents_(contents) {} 19 : contents_(contents) {}
19 20
20 PepperPlaybackObserver::~PepperPlaybackObserver() { 21 PepperPlaybackObserver::~PepperPlaybackObserver() {
21 // At this point WebContents is being destructed, so it's safe to 22 // At this point WebContents is being destructed, so it's safe to
22 // call this. MediaSession may decide to send further IPC messages 23 // call this. MediaSession may decide to send further IPC messages
(...skipping 23 matching lines...) Expand all
46 players_played_sound_map_[pp_instance] = true; 47 players_played_sound_map_[pp_instance] = true;
47 48
48 if (!base::FeatureList::IsEnabled(media::kFlashJoinsMediaSession)) 49 if (!base::FeatureList::IsEnabled(media::kFlashJoinsMediaSession))
49 return; 50 return;
50 51
51 if (players_map_.count(pp_instance)) 52 if (players_map_.count(pp_instance))
52 return; 53 return;
53 54
54 players_map_[pp_instance].reset(new PepperPlayerDelegate( 55 players_map_[pp_instance].reset(new PepperPlayerDelegate(
55 contents_, pp_instance)); 56 contents_, pp_instance));
56 MediaSession::Get(contents_)->AddPlayer( 57 MediaSession::Get(contents_)->AddPlayer(players_map_[pp_instance].get(),
57 players_map_[pp_instance].get(), 58 PepperPlayerDelegate::kPlayerId,
58 PepperPlayerDelegate::kPlayerId, 59 media::MediaContentType::Unpausable);
59 MediaSession::Type::Content);
60 } 60 }
61 61
62 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { 62 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) {
63 if (!players_map_.count(pp_instance)) 63 if (!players_map_.count(pp_instance))
64 return; 64 return;
65 65
66 MediaSession::Get(contents_)->RemovePlayer( 66 MediaSession::Get(contents_)->RemovePlayer(
67 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); 67 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId);
68 68
69 players_map_.erase(pp_instance); 69 players_map_.erase(pp_instance);
70 } 70 }
71 71
72 } // namespace content 72 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698