OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
9 #include "content/browser/media/android/browser_demuxer_android.h" | 9 #include "content/browser/media/android/browser_demuxer_android.h" |
10 #include "content/browser/media/android/media_resource_getter_impl.h" | 10 #include "content/browser/media/android/media_resource_getter_impl.h" |
11 #include "content/browser/renderer_host/render_view_host_impl.h" | 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
12 #include "content/browser/web_contents/web_contents_view_android.h" | 12 #include "content/browser/web_contents/web_contents_view_android.h" |
13 #include "content/common/media/media_player_messages_android.h" | 13 #include "content/common/media/media_player_messages_android.h" |
| 14 #include "content/public/browser/android/content_view_core.h" |
14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
17 #include "content/public/browser/storage_partition.h" | 18 #include "content/public/browser/storage_partition.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
20 #include "media/base/android/media_drm_bridge.h" | 21 #include "media/base/android/media_drm_bridge.h" |
21 #include "media/base/android/media_player_bridge.h" | 22 #include "media/base/android/media_player_bridge.h" |
22 #include "media/base/android/media_source_player.h" | 23 #include "media/base/android/media_source_player.h" |
23 #include "media/base/media_switches.h" | 24 #include "media/base/media_switches.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const GURL& url, | 58 const GURL& url, |
58 const GURL& first_party_for_cookies, | 59 const GURL& first_party_for_cookies, |
59 int demuxer_client_id, | 60 int demuxer_client_id, |
60 bool hide_url_log, | 61 bool hide_url_log, |
61 MediaPlayerManager* manager, | 62 MediaPlayerManager* manager, |
62 BrowserDemuxerAndroid* demuxer) { | 63 BrowserDemuxerAndroid* demuxer) { |
63 switch (type) { | 64 switch (type) { |
64 case MEDIA_PLAYER_TYPE_URL: { | 65 case MEDIA_PLAYER_TYPE_URL: { |
65 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( | 66 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( |
66 player_id, url, first_party_for_cookies, hide_url_log, manager); | 67 player_id, url, first_party_for_cookies, hide_url_log, manager); |
67 media_player_bridge->Initialize(); | 68 BrowserMediaPlayerManager* browser_media_player_manager = |
| 69 static_cast<BrowserMediaPlayerManager*>(manager); |
| 70 ContentViewCoreImpl* content_view_core_impl = |
| 71 static_cast<ContentViewCoreImpl*>(ContentViewCore::FromWebContents( |
| 72 browser_media_player_manager->web_contents_)); |
| 73 if (!content_view_core_impl->ShouldBlockMediaRequest(url)) |
| 74 media_player_bridge->Initialize(); |
68 return media_player_bridge; | 75 return media_player_bridge; |
69 } | 76 } |
70 | 77 |
71 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { | 78 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { |
72 return new MediaSourcePlayer( | 79 return new MediaSourcePlayer( |
73 player_id, manager, demuxer->CreateDemuxer(demuxer_client_id)); | 80 player_id, manager, demuxer->CreateDemuxer(demuxer_client_id)); |
74 } | 81 } |
75 } | 82 } |
76 | 83 |
77 NOTREACHED(); | 84 NOTREACHED(); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 if (pending_fullscreen_player_id_ != media_keys_id) | 685 if (pending_fullscreen_player_id_ != media_keys_id) |
679 return; | 686 return; |
680 | 687 |
681 pending_fullscreen_player_id_ = -1; | 688 pending_fullscreen_player_id_ = -1; |
682 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 689 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
683 if (player->IsPlaying()) | 690 if (player->IsPlaying()) |
684 OnProtectedSurfaceRequested(media_keys_id); | 691 OnProtectedSurfaceRequested(media_keys_id); |
685 } | 692 } |
686 | 693 |
687 } // namespace content | 694 } // namespace content |
OLD | NEW |