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

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

Issue 928643003: Upstream Chrome for Android Cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dependencies (second attempt). Created 5 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_MANAGER_H_
6 #define CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_MANAGER_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "chrome/browser/media/android/remote/remote_media_player_bridge.h"
13 #include "content/browser/media/android/browser_media_player_manager.h"
14 #include "media/base/android/media_player_android.h"
15
16 struct MediaPlayerHostMsg_Initialize_Params;
17
18 namespace remote_media {
19
20 // media::MediaPlayerManager implementation that allows the user to play media
21 // remotely.
22 class RemoteMediaPlayerManager : public content::BrowserMediaPlayerManager {
23 public:
24 RemoteMediaPlayerManager(
25 content::RenderFrameHost* render_frame_host,
26 content::MediaPlayersObserver* audio_monitor);
27 ~RemoteMediaPlayerManager() override;
28
29 void OnPlaying(int player_id);
30 void OnPaused(int player_id);
31
32 // Callback to trigger when a remote device has been selected.
33 void OnRemoteDeviceSelected(int player_id);
34
35 // Callback to trigger when a remote device has been unselected.
36 void OnRemoteDeviceUnselected(int player_id);
37
38 // Callback to trigger when the video on a remote device finishes playing.
39 void OnRemotePlaybackFinished(int player_id);
40
41 // Callback to trigger when the availability of remote routes changes.
42 void OnRouteAvailabilityChanged(int tab_id, bool routes_available);
43
44 void OnMediaMetadataChanged(int player_id,
45 base::TimeDelta duration,
46 int width,
47 int height,
48 bool success) override;
49
50 protected:
51 void OnSetPoster(int player_id, const GURL& url) override;
52
53 private:
54 // Returns a MediaPlayerAndroid implementation for playing the media remotely.
55 RemoteMediaPlayerBridge* CreateRemoteMediaPlayer(
56 media::MediaPlayerAndroid* local_player);
57
58 // Replaces the given local player with the remote one. Does nothing if the
59 // player is remote already.
60 void ReplaceLocalPlayerWithRemote(media::MediaPlayerAndroid* player);
61
62 // Replaces the remote player with the local player this class is holding.
63 // Does nothing if there is no remote player.
64 void ReplaceRemotePlayerWithLocal();
65
66 // Checks if the URL managed by the player should be played remotely.
67 // Returns true if the manager should do nothing, false if it needs to
68 // proceed.
69 bool MaybeStartPlayingRemotely(int player_id);
70
71 // content::BrowserMediaPlayerManager overrides.
72 void OnStart(int player_id) override;
73 void OnInitialize(
74 const MediaPlayerHostMsg_Initialize_Params& media_player_params) override;
75 void OnDestroyPlayer(int player_id) override;
76 void OnReleaseResources(int player_id) override;
77 void OnRequestRemotePlayback(int player_id) override;
78 void OnRequestRemotePlaybackControl(int player_id) override;
79
80 void ReleaseFullscreenPlayer(media::MediaPlayerAndroid* player) override;
81
82 // Callback for when the download of poster image is done.
83 void DidDownloadPoster(
84 int player_id,
85 int id,
86 int http_status_code,
87 const GURL& image_url,
88 const std::vector<SkBitmap>& bitmaps,
89 const std::vector<gfx::Size>& original_bitmap_sizes);
90
91 // Return the ID of the tab that's associated with this controller. Returns
92 // -1 in case something goes wrong.
93 int GetTabId();
94
95 // Get the player id of current remote player, if any, or -1 if none.
96 int RemotePlayerId();
97
98 // Get the remote player for a given player id, whether or not it is currently
99 // playing remotely.
100 RemoteMediaPlayerBridge* GetRemotePlayer(int player_id);
101
102 // The local player that we have replaced with a remote player. This is NULL
103 // if we do not have a remote player currently running.
104 scoped_ptr<media::MediaPlayerAndroid> replaced_local_player_;
105
106 ScopedVector<RemoteMediaPlayerBridge> remote_players_;
107
108 base::WeakPtrFactory<RemoteMediaPlayerManager> weak_ptr_factory_;
109
110 DISALLOW_COPY_AND_ASSIGN(RemoteMediaPlayerManager);
111 };
112
113 } // namespace remote_media
114
115 #endif // CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698