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

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: Rebased the change 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 int player_id, base::TimeDelta duration, int width, int height, 278 int player_id, base::TimeDelta duration, int width, int height,
279 bool success) { 279 bool success) {
280 Send(new MediaPlayerMsg_MediaMetadataChanged( 280 Send(new MediaPlayerMsg_MediaMetadataChanged(
281 RoutingID(), player_id, duration, width, height, success)); 281 RoutingID(), player_id, duration, width, height, success));
282 if (fullscreen_player_id_ == player_id) 282 if (fullscreen_player_id_ == player_id)
283 video_view_->UpdateMediaMetadata(); 283 video_view_->UpdateMediaMetadata();
284 } 284 }
285 285
286 void BrowserMediaPlayerManager::OnPlaybackComplete(int player_id) { 286 void BrowserMediaPlayerManager::OnPlaybackComplete(int player_id) {
287 Send(new MediaPlayerMsg_MediaPlaybackCompleted(RoutingID(), player_id)); 287 Send(new MediaPlayerMsg_MediaPlaybackCompleted(RoutingID(), player_id));
288
288 MediaSession::Get(web_contents())->RemovePlayer(this, player_id); 289 MediaSession::Get(web_contents())->RemovePlayer(this, player_id);
289 290
290 if (fullscreen_player_id_ == player_id) 291 if (fullscreen_player_id_ == player_id)
291 video_view_->OnPlaybackComplete(); 292 video_view_->OnPlaybackComplete();
292 } 293 }
293 294
294 void BrowserMediaPlayerManager::OnMediaInterrupted(int player_id) { 295 void BrowserMediaPlayerManager::OnMediaInterrupted(int player_id) {
295 // Tell WebKit that the audio should be paused, then release all resources 296 // Tell WebKit that the audio should be paused, then release all resources
296 Send(new MediaPlayerMsg_MediaPlayerReleased(RoutingID(), player_id)); 297 Send(new MediaPlayerMsg_MediaPlayerReleased(RoutingID(), player_id));
297 OnReleaseResources(player_id); 298 OnReleaseResources(player_id);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 player->SeekTo(time); 566 player->SeekTo(time);
566 } 567 }
567 568
568 void BrowserMediaPlayerManager::OnPause( 569 void BrowserMediaPlayerManager::OnPause(
569 int player_id, 570 int player_id,
570 bool is_media_related_action) { 571 bool is_media_related_action) {
571 MediaPlayerAndroid* player = GetPlayer(player_id); 572 MediaPlayerAndroid* player = GetPlayer(player_id);
572 if (player) 573 if (player)
573 player->Pause(is_media_related_action); 574 player->Pause(is_media_related_action);
574 575
575 MediaSession::Get(web_contents())->RemovePlayer(this, player_id); 576 if (is_media_related_action)
577 MediaSession::Get(web_contents())->RemovePlayer(this, player_id);
576 } 578 }
577 579
578 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) { 580 void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) {
579 MediaPlayerAndroid* player = GetPlayer(player_id); 581 MediaPlayerAndroid* player = GetPlayer(player_id);
580 if (player) 582 if (player)
581 player->SetVolume(volume); 583 player->SetVolume(volume);
582 } 584 }
583 585
584 void BrowserMediaPlayerManager::OnSetPoster(int player_id, const GURL& url) { 586 void BrowserMediaPlayerManager::OnSetPoster(int player_id, const GURL& url) {
585 // To be overridden by subclasses. 587 // To be overridden by subclasses.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); 692 external_video_surface_container_->ReleaseExternalVideoSurface(player_id);
691 #endif // defined(VIDEO_HOLE) 693 #endif // defined(VIDEO_HOLE)
692 } 694 }
693 695
694 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { 696 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) {
695 player->Release(); 697 player->Release();
696 ReleaseMediaResources(player->player_id()); 698 ReleaseMediaResources(player->player_id());
697 } 699 }
698 700
699 } // namespace content 701 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_web_contents_delegate_android.cc ('k') | content/browser/media/android/media_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698