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/android/content_view_core.h" |
15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/storage_partition.h" | 18 #include "content/public/browser/storage_partition.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 21 #include "content/public/common/content_client.h" |
21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
22 #include "media/base/android/media_drm_bridge.h" | 23 #include "media/base/android/media_drm_bridge.h" |
23 #include "media/base/android/media_player_bridge.h" | 24 #include "media/base/android/media_player_bridge.h" |
24 #include "media/base/android/media_source_player.h" | 25 #include "media/base/android/media_source_player.h" |
25 #include "media/base/media_switches.h" | 26 #include "media/base/media_switches.h" |
26 | 27 |
27 using media::MediaDrmBridge; | 28 using media::MediaDrmBridge; |
28 using media::MediaPlayerAndroid; | 29 using media::MediaPlayerAndroid; |
29 using media::MediaPlayerBridge; | 30 using media::MediaPlayerBridge; |
30 using media::MediaPlayerManager; | 31 using media::MediaPlayerManager; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 MediaPlayerHostMsg_Initialize_Type type, | 70 MediaPlayerHostMsg_Initialize_Type type, |
70 int player_id, | 71 int player_id, |
71 const GURL& url, | 72 const GURL& url, |
72 const GURL& first_party_for_cookies, | 73 const GURL& first_party_for_cookies, |
73 int demuxer_client_id, | 74 int demuxer_client_id, |
74 bool hide_url_log, | 75 bool hide_url_log, |
75 MediaPlayerManager* manager, | 76 MediaPlayerManager* manager, |
76 BrowserDemuxerAndroid* demuxer) { | 77 BrowserDemuxerAndroid* demuxer) { |
77 switch (type) { | 78 switch (type) { |
78 case MEDIA_PLAYER_TYPE_URL: { | 79 case MEDIA_PLAYER_TYPE_URL: { |
| 80 const std::string& user_agent = GetUserAgent(url); |
79 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( | 81 MediaPlayerBridge* media_player_bridge = new MediaPlayerBridge( |
80 player_id, url, first_party_for_cookies, hide_url_log, manager); | 82 player_id, |
| 83 url, |
| 84 first_party_for_cookies, |
| 85 user_agent, |
| 86 hide_url_log, |
| 87 manager); |
81 BrowserMediaPlayerManager* browser_media_player_manager = | 88 BrowserMediaPlayerManager* browser_media_player_manager = |
82 static_cast<BrowserMediaPlayerManager*>(manager); | 89 static_cast<BrowserMediaPlayerManager*>(manager); |
83 ContentViewCoreImpl* content_view_core_impl = | 90 ContentViewCoreImpl* content_view_core_impl = |
84 static_cast<ContentViewCoreImpl*>(ContentViewCore::FromWebContents( | 91 static_cast<ContentViewCoreImpl*>(ContentViewCore::FromWebContents( |
85 browser_media_player_manager->web_contents_)); | 92 browser_media_player_manager->web_contents_)); |
86 if (!content_view_core_impl) { | 93 if (!content_view_core_impl) { |
87 // May reach here due to prerendering. Don't extract the metadata | 94 // May reach here due to prerendering. Don't extract the metadata |
88 // since it is expensive. | 95 // since it is expensive. |
89 // TODO(qinmin): extract the metadata once the user decided to load | 96 // TODO(qinmin): extract the metadata once the user decided to load |
90 // the page. | 97 // the page. |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 if (pending_fullscreen_player_id_ != media_keys_id) | 791 if (pending_fullscreen_player_id_ != media_keys_id) |
785 return; | 792 return; |
786 | 793 |
787 pending_fullscreen_player_id_ = -1; | 794 pending_fullscreen_player_id_ = -1; |
788 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 795 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
789 if (player->IsPlaying()) | 796 if (player->IsPlaying()) |
790 OnProtectedSurfaceRequested(media_keys_id); | 797 OnProtectedSurfaceRequested(media_keys_id); |
791 } | 798 } |
792 | 799 |
793 } // namespace content | 800 } // namespace content |
OLD | NEW |