Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: content/browser/media/android/browser_media_player_manager.cc

Issue 1159113006: [Android] A prototype of the interactive media notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/android/scoped_java_ref.h" 7 #include "base/android/scoped_java_ref.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/browser/android/content_view_core_impl.h" 9 #include "content/browser/android/content_view_core_impl.h"
10 #include "content/browser/android/media_players_observer.h" 10 #include "content/browser/android/media_players_observer.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 int player_id, base::TimeDelta duration, int width, int height, 226 int player_id, base::TimeDelta duration, int width, int height,
227 bool success) { 227 bool success) {
228 Send(new MediaPlayerMsg_MediaMetadataChanged( 228 Send(new MediaPlayerMsg_MediaMetadataChanged(
229 RoutingID(), player_id, duration, width, height, success)); 229 RoutingID(), player_id, duration, width, height, success));
230 if (fullscreen_player_id_ == player_id) 230 if (fullscreen_player_id_ == player_id)
231 video_view_->UpdateMediaMetadata(); 231 video_view_->UpdateMediaMetadata();
232 } 232 }
233 233
234 void BrowserMediaPlayerManager::OnPlaybackComplete(int player_id) { 234 void BrowserMediaPlayerManager::OnPlaybackComplete(int player_id) {
235 Send(new MediaPlayerMsg_MediaPlaybackCompleted(RoutingID(), player_id)); 235 Send(new MediaPlayerMsg_MediaPlaybackCompleted(RoutingID(), player_id));
236
236 MediaSession::Get(web_contents())->RemovePlayer(this, player_id); 237 MediaSession::Get(web_contents())->RemovePlayer(this, player_id);
237 238
238 if (fullscreen_player_id_ == player_id) 239 if (fullscreen_player_id_ == player_id)
239 video_view_->OnPlaybackComplete(); 240 video_view_->OnPlaybackComplete();
240 } 241 }
241 242
242 void BrowserMediaPlayerManager::OnMediaInterrupted(int player_id) { 243 void BrowserMediaPlayerManager::OnMediaInterrupted(int player_id) {
243 // Tell WebKit that the audio should be paused, then release all resources 244 // Tell WebKit that the audio should be paused, then release all resources
244 Send(new MediaPlayerMsg_MediaPlayerReleased(RoutingID(), player_id)); 245 Send(new MediaPlayerMsg_MediaPlayerReleased(RoutingID(), player_id));
245 OnReleaseResources(player_id); 246 OnReleaseResources(player_id);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 player->SeekTo(time); 523 player->SeekTo(time);
523 } 524 }
524 525
525 void BrowserMediaPlayerManager::OnPause( 526 void BrowserMediaPlayerManager::OnPause(
526 int player_id, 527 int player_id,
527 bool is_media_related_action) { 528 bool is_media_related_action) {
528 MediaPlayerAndroid* player = GetPlayer(player_id); 529 MediaPlayerAndroid* player = GetPlayer(player_id);
529 if (player) 530 if (player)
530 player->Pause(is_media_related_action); 531 player->Pause(is_media_related_action);
531 532
532 MediaSession::Get(web_contents())->RemovePlayer(this, player_id); 533 if (is_media_related_action)
mlamouri (slow - plz ping) 2015/06/18 16:43:22 When do you end up in that situation?
whywhat 2015/06/19 16:00:34 So it happens when I go to the notification and pa
mlamouri (slow - plz ping) 2015/06/22 14:34:17 Ok.
534 MediaSession::Get(web_contents())->RemovePlayer(this, player_id);
533 } 535 }
534 536
535 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) { 537 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) {
536 MediaPlayerAndroid* player = GetPlayer(player_id); 538 MediaPlayerAndroid* player = GetPlayer(player_id);
537 if (player) 539 if (player)
538 player->SetVolume(volume); 540 player->SetVolume(volume);
539 } 541 }
540 542
541 void BrowserMediaPlayerManager::OnSetPoster(int player_id, const GURL& url) { 543 void BrowserMediaPlayerManager::OnSetPoster(int player_id, const GURL& url) {
542 // To be overridden by subclasses. 544 // To be overridden by subclasses.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); 648 external_video_surface_container_->ReleaseExternalVideoSurface(player_id);
647 #endif // defined(VIDEO_HOLE) 649 #endif // defined(VIDEO_HOLE)
648 } 650 }
649 651
650 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { 652 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) {
651 player->Release(); 653 player->Release();
652 ReleaseMediaResources(player->player_id()); 654 ReleaseMediaResources(player->player_id());
653 } 655 }
654 656
655 } // namespace content 657 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698