| 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 "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 21 #include "media/base/android/media_drm_bridge.h" | 22 #include "media/base/android/media_drm_bridge.h" |
| 22 #include "media/base/android/media_player_bridge.h" | 23 #include "media/base/android/media_player_bridge.h" |
| 23 #include "media/base/android/media_source_player.h" | 24 #include "media/base/android/media_source_player.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const GURL& url, | 59 const GURL& url, |
| 59 const GURL& first_party_for_cookies, | 60 const GURL& first_party_for_cookies, |
| 60 int demuxer_client_id, | 61 int demuxer_client_id, |
| 61 bool hide_url_log, | 62 bool hide_url_log, |
| 62 MediaPlayerManager* manager, | 63 MediaPlayerManager* manager, |
| 63 BrowserDemuxerAndroid* demuxer) { | 64 BrowserDemuxerAndroid* demuxer) { |
| 64 switch (type) { | 65 switch (type) { |
| 65 case MEDIA_PLAYER_TYPE_URL: { | 66 case MEDIA_PLAYER_TYPE_URL: { |
| 66 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( | 67 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( |
| 67 player_id, url, first_party_for_cookies, hide_url_log, manager); | 68 player_id, url, first_party_for_cookies, hide_url_log, manager); |
| 68 media_player_bridge->Initialize(); | 69 BrowserMediaPlayerManager* browser_media_player_manager = |
| 70 static_cast<BrowserMediaPlayerManager*>(manager); |
| 71 ContentViewCoreImpl* content_view_core_impl = |
| 72 static_cast<ContentViewCoreImpl*>(ContentViewCore::FromWebContents( |
| 73 browser_media_player_manager->web_contents_)); |
| 74 if (!content_view_core_impl->ShouldBlockMediaRequest(url)) |
| 75 media_player_bridge->Initialize(); |
| 69 return media_player_bridge; | 76 return media_player_bridge; |
| 70 } | 77 } |
| 71 | 78 |
| 72 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { | 79 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { |
| 73 return new MediaSourcePlayer( | 80 return new MediaSourcePlayer( |
| 74 player_id, manager, demuxer->CreateDemuxer(demuxer_client_id)); | 81 player_id, manager, demuxer->CreateDemuxer(demuxer_client_id)); |
| 75 } | 82 } |
| 76 } | 83 } |
| 77 | 84 |
| 78 NOTREACHED(); | 85 NOTREACHED(); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 if (pending_fullscreen_player_id_ != media_keys_id) | 701 if (pending_fullscreen_player_id_ != media_keys_id) |
| 695 return; | 702 return; |
| 696 | 703 |
| 697 pending_fullscreen_player_id_ = -1; | 704 pending_fullscreen_player_id_ = -1; |
| 698 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 705 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
| 699 if (player->IsPlaying()) | 706 if (player->IsPlaying()) |
| 700 OnProtectedSurfaceRequested(media_keys_id); | 707 OnProtectedSurfaceRequested(media_keys_id); |
| 701 } | 708 } |
| 702 | 709 |
| 703 } // namespace content | 710 } // namespace content |
| OLD | NEW |