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

Unified Diff: content/browser/media/session/pepper_playback_observer.h

Issue 2551093002: Route Pepper MediaSession messages to frames (Closed)
Patch Set: addressed Anton's comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/session/pepper_playback_observer.h
diff --git a/content/browser/media/session/pepper_playback_observer.h b/content/browser/media/session/pepper_playback_observer.h
index 9aacf007dbfbf084dbb8c5e91349e3318a882c57..483bd5c18909feec6c99b667918e1aa998135ba1 100644
--- a/content/browser/media/session/pepper_playback_observer.h
+++ b/content/browser/media/session/pepper_playback_observer.h
@@ -8,43 +8,51 @@
#include <stdint.h>
#include <map>
#include <memory>
+#include <utility>
#include "base/macros.h"
namespace content {
class PepperPlayerDelegate;
-class WebContentsImpl;
+class RenderFrameHost;
+class WebContents;
// Class observing Pepper playback changes from WebContents, and update
-// MediaSession accordingly. Can only be a member of WebContentsImpl and must be
-// destroyed in ~WebContentsImpl().
+// MediaSession accordingly. Can only be a member of WebContents and must be
+// destroyed in ~WebContents().
class PepperPlaybackObserver {
public:
- explicit PepperPlaybackObserver(WebContentsImpl* contents);
+ explicit PepperPlaybackObserver(WebContents* contents);
virtual ~PepperPlaybackObserver();
- void PepperInstanceCreated(int32_t pp_instance);
- void PepperInstanceDeleted(int32_t pp_instance);
+ void PepperInstanceCreated(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
+ void PepperInstanceDeleted(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
// This method is called when a Pepper instance starts making sound.
- void PepperStartsPlayback(int32_t pp_instance);
+ void PepperStartsPlayback(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
// This method is called when a Pepper instance stops making sound.
- void PepperStopsPlayback(int32_t pp_instance);
+ void PepperStopsPlayback(RenderFrameHost* render_frame_host,
+ int32_t pp_instance);
private:
+ using PlayerId = std::pair<RenderFrameHost*, int32_t>;
+
// Owning PepperPlayerDelegates.
using PlayersMap =
- std::map<int32_t, std::unique_ptr<PepperPlayerDelegate>>;
+ std::map<PlayerId, std::unique_ptr<PepperPlayerDelegate>>;
PlayersMap players_map_;
// Map for whether Pepper players have ever played sound.
// Used for recording UMA.
using PlayersPlayedSoundMap =
- std::map<int32_t, bool>;
+ std::map<PlayerId, bool>;
PlayersPlayedSoundMap players_played_sound_map_;
// Weak reference to WebContents.
- WebContentsImpl* contents_;
+ WebContents* contents_;
DISALLOW_COPY_AND_ASSIGN(PepperPlaybackObserver);
};

Powered by Google App Engine
This is Rietveld 408576698