| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/android/media_player_manager_android.h" | 5 #include "content/browser/android/media_player_manager_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/android/content_view_core_impl.h" |
| 8 #include "content/browser/android/media_resource_getter_impl.h" | 9 #include "content/browser/android/media_resource_getter_impl.h" |
| 9 #include "content/browser/web_contents/web_contents_view_android.h" | 10 #include "content/browser/web_contents/web_contents_view_android.h" |
| 10 #include "content/common/media/media_player_messages.h" | 11 #include "content/common/media/media_player_messages.h" |
| 11 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
| 13 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
| 14 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
| 16 #include "content/public/browser/web_contents.h" |
| 15 | 17 |
| 16 using media::MediaPlayerBridge; | 18 using media::MediaPlayerBridge; |
| 17 | 19 |
| 18 // Threshold on the number of media players per renderer before we start | 20 // Threshold on the number of media players per renderer before we start |
| 19 // attempting to release inactive media players. | 21 // attempting to release inactive media players. |
| 20 static const int kMediaPlayerThreshold = 1; | 22 static const int kMediaPlayerThreshold = 1; |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 | 25 |
| 24 MediaPlayerManagerAndroid::MediaPlayerManagerAndroid( | 26 MediaPlayerManagerAndroid::MediaPlayerManagerAndroid( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void MediaPlayerManagerAndroid::OnPause(int player_id) { | 152 void MediaPlayerManagerAndroid::OnPause(int player_id) { |
| 151 MediaPlayerBridge* player = GetPlayer(player_id); | 153 MediaPlayerBridge* player = GetPlayer(player_id); |
| 152 if (player) | 154 if (player) |
| 153 player->Pause(); | 155 player->Pause(); |
| 154 } | 156 } |
| 155 | 157 |
| 156 void MediaPlayerManagerAndroid::OnEnterFullscreen(int player_id) { | 158 void MediaPlayerManagerAndroid::OnEnterFullscreen(int player_id) { |
| 157 DCHECK_EQ(fullscreen_player_id_, -1); | 159 DCHECK_EQ(fullscreen_player_id_, -1); |
| 158 | 160 |
| 159 fullscreen_player_id_ = player_id; | 161 fullscreen_player_id_ = player_id; |
| 160 video_view_.CreateContentVideoView(); | 162 WebContents* web_contents = |
| 163 WebContents::FromRenderViewHost(render_view_host()); |
| 164 ContentViewCoreImpl* content_view_core_impl = |
| 165 ContentViewCoreImpl::FromWebContents(web_contents); |
| 166 video_view_.CreateContentVideoView( |
| 167 content_view_core_impl->GetContentVideoViewClient()); |
| 161 } | 168 } |
| 162 | 169 |
| 163 void MediaPlayerManagerAndroid::OnExitFullscreen(int player_id) { | 170 void MediaPlayerManagerAndroid::OnExitFullscreen(int player_id) { |
| 164 if (fullscreen_player_id_ == player_id) { | 171 if (fullscreen_player_id_ == player_id) { |
| 165 MediaPlayerBridge* player = GetPlayer(player_id); | 172 MediaPlayerBridge* player = GetPlayer(player_id); |
| 166 if (player) | 173 if (player) |
| 167 player->SetVideoSurface(NULL); | 174 player->SetVideoSurface(NULL); |
| 168 video_view_.DestroyContentVideoView(); | 175 video_view_.DestroyContentVideoView(); |
| 169 fullscreen_player_id_ = -1; | 176 fullscreen_player_id_ = -1; |
| 170 } | 177 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 327 } |
| 321 } | 328 } |
| 322 } | 329 } |
| 323 | 330 |
| 324 void MediaPlayerManagerAndroid::ReleaseMediaResources( | 331 void MediaPlayerManagerAndroid::ReleaseMediaResources( |
| 325 MediaPlayerBridge* player) { | 332 MediaPlayerBridge* player) { |
| 326 // Nothing needs to be done. | 333 // Nothing needs to be done. |
| 327 } | 334 } |
| 328 | 335 |
| 329 } // namespace content | 336 } // namespace content |
| OLD | NEW |