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

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

Issue 2794283003: Remove MediaThrottler and MediaThrottleInfoBar (Closed)
Patch Set: Deleted Java code Created 3 years, 8 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 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_
6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 public ContentVideoView::Client { 41 public ContentVideoView::Client {
42 public: 42 public:
43 // Permits embedders to provide an extended version of the class. 43 // Permits embedders to provide an extended version of the class.
44 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*); 44 typedef BrowserMediaPlayerManager* (*Factory)(RenderFrameHost*);
45 static void RegisterFactory(Factory factory); 45 static void RegisterFactory(Factory factory);
46 46
47 // Permits embedders to handle custom urls. 47 // Permits embedders to handle custom urls.
48 static void RegisterMediaUrlInterceptor( 48 static void RegisterMediaUrlInterceptor(
49 media::MediaUrlInterceptor* media_url_interceptor); 49 media::MediaUrlInterceptor* media_url_interceptor);
50 50
51 // Returns a new instance using the registered factory if available. 51 // Returns a new instance using the registered factory.
52 // Returns nullptr if no factory was registered.
52 static BrowserMediaPlayerManager* Create(RenderFrameHost* rfh); 53 static BrowserMediaPlayerManager* Create(RenderFrameHost* rfh);
53 54
54 #if !defined(USE_AURA) 55 #if !defined(USE_AURA)
55 ContentViewCore* GetContentViewCore() const; 56 ContentViewCore* GetContentViewCore() const;
56 #endif 57 #endif
57 58
58 ~BrowserMediaPlayerManager() override; 59 ~BrowserMediaPlayerManager() override;
59 60
60 // ContentVideoView::Client implementation. 61 // ContentVideoView::Client implementation.
61 void DidExitFullscreen(bool release_media_player) override; 62 void DidExitFullscreen(bool release_media_player) override;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 private: 154 private:
154 // Constructs a MediaPlayerAndroid object. 155 // Constructs a MediaPlayerAndroid object.
155 std::unique_ptr<media::MediaPlayerAndroid> CreateMediaPlayer( 156 std::unique_ptr<media::MediaPlayerAndroid> CreateMediaPlayer(
156 const MediaPlayerHostMsg_Initialize_Params& media_player_params, 157 const MediaPlayerHostMsg_Initialize_Params& media_player_params,
157 bool hide_url_log); 158 bool hide_url_log);
158 159
159 // Instructs |player| to release its java player. This will not remove the 160 // Instructs |player| to release its java player. This will not remove the
160 // player from |players_|. 161 // player from |players_|.
161 void ReleasePlayer(media::MediaPlayerAndroid* player); 162 void ReleasePlayer(media::MediaPlayerAndroid* player);
162 163
163 // Called when user approves media playback after being throttled.
164 void OnPlaybackPermissionGranted(int player_id, bool granted);
165
166 // Helper method to start playback.
167 void StartInternal(int player_id);
168
169 RenderFrameHost* const render_frame_host_; 164 RenderFrameHost* const render_frame_host_;
170 165
171 // An array of managed players. 166 // An array of managed players.
172 std::vector<std::unique_ptr<media::MediaPlayerAndroid>> players_; 167 std::vector<std::unique_ptr<media::MediaPlayerAndroid>> players_;
173 168
174 typedef std::map<int, bool> ActivePlayerMap; 169 typedef std::map<int, bool> ActivePlayerMap;
175 // Players that have requested decoding resources. Even though resource is 170 // Players that have requested decoding resources. Even though resource is
176 // requested, a player may be in a paused or error state and the manager 171 // requested, a player may be in a paused or error state and the manager
177 // will release its resources later. 172 // will release its resources later.
178 ActivePlayerMap active_players_; 173 ActivePlayerMap active_players_;
(...skipping 19 matching lines...) Expand all
198 193
199 // NOTE: Weak pointers must be invalidated before all other member variables. 194 // NOTE: Weak pointers must be invalidated before all other member variables.
200 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; 195 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_;
201 196
202 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); 197 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager);
203 }; 198 };
204 199
205 } // namespace content 200 } // namespace content
206 201
207 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ 202 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698