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

Side by Side Diff: chrome/browser/media/android/remote/remote_media_player_manager.cc

Issue 1570043002: Implement MediaSession on top of the WebMediaPlayerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session
Patch Set: Comments. Fix test? Created 4 years, 11 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 "chrome/browser/media/android/remote/remote_media_player_manager.h" 5 #include "chrome/browser/media/android/remote/remote_media_player_manager.h"
6 6
7 #include "chrome/browser/android/tab_android.h" 7 #include "chrome/browser/android/tab_android.h"
8 #include "chrome/common/chrome_content_client.h" 8 #include "chrome/common/chrome_content_client.h"
9 #include "content/common/media/media_player_messages_android.h" 9 #include "content/common/media/media_player_messages_android.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 RemoteMediaPlayerBridge* player = new RemoteMediaPlayerBridge( 132 RemoteMediaPlayerBridge* player = new RemoteMediaPlayerBridge(
133 local_player, 133 local_player,
134 GetUserAgent(), 134 GetUserAgent(),
135 false, 135 false,
136 this); 136 this);
137 alternative_players_.push_back(player); 137 alternative_players_.push_back(player);
138 player->Initialize(); 138 player->Initialize();
139 return player; 139 return player;
140 } 140 }
141 141
142 // OnSuspend and OnResume are called when the local player loses or gains
143 // audio focus. If we are playing remotely then ignore these.
144 void RemoteMediaPlayerManager::OnSuspend(int player_id) {
145 if (!IsPlayingRemotely(player_id))
146 BrowserMediaPlayerManager::OnSuspend(player_id);
147 }
148
149 void RemoteMediaPlayerManager::OnResume(int player_id) {
150 if (!IsPlayingRemotely(player_id))
151 BrowserMediaPlayerManager::OnResume(player_id);
152 }
153
154 void RemoteMediaPlayerManager::SwapCurrentPlayer(int player_id) { 142 void RemoteMediaPlayerManager::SwapCurrentPlayer(int player_id) {
155 // Find the remote player 143 // Find the remote player
156 auto it = GetAlternativePlayer(player_id); 144 auto it = GetAlternativePlayer(player_id);
157 if (it == alternative_players_.end()) 145 if (it == alternative_players_.end())
158 return; 146 return;
159 MediaPlayerAndroid* new_player = *it; 147 MediaPlayerAndroid* new_player = *it;
160 scoped_ptr<MediaPlayerAndroid> old_player = SwapPlayer(player_id, new_player); 148 scoped_ptr<MediaPlayerAndroid> old_player = SwapPlayer(player_id, new_player);
161 alternative_players_.weak_erase(it); 149 alternative_players_.weak_erase(it);
162 alternative_players_.push_back(old_player.release()); 150 alternative_players_.push_back(old_player.release());
163 } 151 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 MediaPlayerAndroid* local_player = GetLocalPlayer(player_id); 255 MediaPlayerAndroid* local_player = GetLocalPlayer(player_id);
268 Send(new MediaPlayerMsg_MediaMetadataChanged( 256 Send(new MediaPlayerMsg_MediaMetadataChanged(
269 RoutingID(), player_id, duration, local_player->GetVideoWidth(), 257 RoutingID(), player_id, duration, local_player->GetVideoWidth(),
270 local_player->GetVideoHeight(), success)); 258 local_player->GetVideoHeight(), success));
271 } else { 259 } else {
272 BrowserMediaPlayerManager::OnMediaMetadataChanged(player_id, duration, 260 BrowserMediaPlayerManager::OnMediaMetadataChanged(player_id, duration,
273 width, height, success); 261 width, height, success);
274 } 262 }
275 } 263 }
276 } // namespace remote_media 264 } // namespace remote_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698