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

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: Created 5 years, 10 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 CLANK_NATIVE_FRAMEWORK_CHROME_REMOTE_MEDIA_PLAYER_MANAGER_H_
whywhat 2015/02/25 16:31:32 Update the include guards
aberent 2015/03/11 18:29:58 Done.
6 #define CLANK_NATIVE_FRAMEWORK_CHROME_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 explicit RemoteMediaPlayerManager(
25 content::RenderFrameHost* render_frame_host);
26 ~RemoteMediaPlayerManager() override;
27
28 void OnPlaying(int player_id);
29 void OnPaused(int player_id);
30
31 // Callback to trigger when a remote device has been selected.
32 void OnRemoteDeviceSelected(int player_id);
33
34 // Callback to trigger when a remote device has been unselected.
35 void OnRemoteDeviceUnselected(int player_id);
36
37 // Callback to trigger when the video on a remote device finishes playing.
38 void OnRemotePlaybackFinished(int player_id);
39
40 // Callback to trigger when the availability of remote routes changes.
41 void OnRouteAvailabilityChanged(int tab_id, bool routes_available);
42
43 void OnMediaMetadataChanged(int player_id,
44 base::TimeDelta duration,
45 int width,
46 int height,
47 bool success) override;
48
49 protected:
50 void OnSetPoster(int player_id, const GURL& url) override;
51
52 private:
53 // Returns a MediaPlayerAndroid implementation for playing the media remotely.
54 RemoteMediaPlayerBridge* CreateRemoteMediaPlayer(
55 media::MediaPlayerAndroid* local_player);
56
57 // Replaces the given local player with the remote one. Does nothing if the
58 // player is remote already.
59 void ReplaceLocalPlayerWithRemote(media::MediaPlayerAndroid* player);
60
61 // Replaces the remote player with the local player this class is holding.
62 // Does nothing if there is no remote player.
63 void ReplaceRemotePlayerWithLocal();
64
65 // Checks if the URL managed by the player should be played remotely.
66 // Returns true if the manager should do nothing, false if it needs to
67 // proceed.
68 bool MaybeStartPlayingRemotely(int player_id);
69
70 // content::BrowserMediaPlayerManager overrides.
71 void OnStart(int player_id) override;
72 void OnInitialize(
73 const MediaPlayerHostMsg_Initialize_Params& media_player_params) override;
74 void OnDestroyPlayer(int player_id) override;
75 void OnReleaseResources(int player_id) override;
76 void OnRequestRemotePlayback(int player_id) override;
77 void OnRequestRemotePlaybackControl(int player_id) override;
78
79 void ReleaseFullscreenPlayer(media::MediaPlayerAndroid* player) override;
80
81 // Callback for when the download of poster image is done.
82 void DidDownloadPoster(
83 int player_id,
84 int id,
85 int http_status_code,
86 const GURL& image_url,
87 const std::vector<SkBitmap>& bitmaps,
88 const std::vector<gfx::Size>& original_bitmap_sizes);
89
90 // Return the ID of the tab that's associated with this controller. Returns
91 // -1 in case something goes wrong.
92 int GetTabId();
93
94 // Get the player id of current remote player, if any, or -1 if none.
95 int RemotePlayerId();
96
97 // Get the remote player for a given player id, whether or not it is currently
98 // playing remotely.
99 RemoteMediaPlayerBridge* GetRemotePlayer(int player_id);
100
101 // The local player that we have replaced with a remote player. This is NULL
102 // if we do not have a remote player currently running.
103 scoped_ptr<media::MediaPlayerAndroid> replaced_local_player_;
104
105 ScopedVector<RemoteMediaPlayerBridge> remote_players_;
106
107 base::WeakPtrFactory<RemoteMediaPlayerManager> weak_ptr_factory_;
108
109 DISALLOW_COPY_AND_ASSIGN(RemoteMediaPlayerManager);
110 };
111 } // namespace remote_media
whywhat 2015/02/25 16:31:32 blank line before the namespace closing bracket
aberent 2015/03/11 18:29:58 Done.
112
113 #endif // CLANK_NATIVE_FRAMEWORK_CHROME_REMOTE_MEDIA_PLAYER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698