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.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 26 matching lines...) Expand all Loading... |
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( |
57 players_map_[pp_instance].get(), | 58 players_map_[pp_instance].get(), |
58 PepperPlayerDelegate::kPlayerId, | 59 PepperPlayerDelegate::kPlayerId, |
59 MediaSession::Type::Content); | 60 media::MediaContentType::Unpausable); |
60 } | 61 } |
61 | 62 |
62 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { | 63 void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) { |
63 if (!players_map_.count(pp_instance)) | 64 if (!players_map_.count(pp_instance)) |
64 return; | 65 return; |
65 | 66 |
66 MediaSession::Get(contents_)->RemovePlayer( | 67 MediaSession::Get(contents_)->RemovePlayer( |
67 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); | 68 players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId); |
68 | 69 |
69 players_map_.erase(pp_instance); | 70 players_map_.erase(pp_instance); |
70 } | 71 } |
71 | 72 |
72 } // namespace content | 73 } // namespace content |
OLD | NEW |