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

Side by Side Diff: content/browser/media/session/pepper_playback_observer.h

Issue 2428873002: Add about_flag for experimenting MediaSession on Desktop (Closed)
Patch Set: fixed cast_shell build Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_SESSION_PEPPER_PLAYBACK_OBSERVER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_PEPPER_PLAYBACK_OBSERVER_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_PEPPER_PLAYBACK_OBSERVER_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_PEPPER_PLAYBACK_OBSERVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class PepperPlayerDelegate; 16 class PepperPlayerDelegate;
17 class WebContentsImpl; 17 class WebContentsImpl;
18 18
19 // Class observing Pepper playback changes from WebContents, and update 19 // Class observing Pepper playback changes from WebContents, and update
20 // MediaSession accordingly. Can only be a member of WebContentsImpl and must be 20 // MediaSession accordingly. Can only be a member of WebContentsImpl and must be
21 // destroyed in ~WebContentsImpl(). 21 // destroyed in ~WebContentsImpl().
22 class PepperPlaybackObserver { 22 class PepperPlaybackObserver {
23 public: 23 public:
24 explicit PepperPlaybackObserver(WebContentsImpl* contents); 24 explicit PepperPlaybackObserver(WebContentsImpl* contents);
25 virtual ~PepperPlaybackObserver(); 25 virtual ~PepperPlaybackObserver();
26 26
27 void PepperInstanceCreated(int32_t pp_instance); 27 void PepperInstanceCreated(int32_t pp_instance);
28 void PepperInstanceDeleted(int32_t pp_instance); 28 void PepperInstanceDeleted(int32_t pp_instance);
29 // This method is called when a Pepper instance starts making sound.
29 void PepperStartsPlayback(int32_t pp_instance); 30 void PepperStartsPlayback(int32_t pp_instance);
31 // This method is called when a Pepper instance stops making sound.
30 void PepperStopsPlayback(int32_t pp_instance); 32 void PepperStopsPlayback(int32_t pp_instance);
31 33
32 private: 34 private:
33 // Owning PepperPlayerDelegates. 35 // Owning PepperPlayerDelegates.
34 using PlayersMap = 36 using PlayersMap =
35 std::map<int32_t, std::unique_ptr<PepperPlayerDelegate>>; 37 std::map<int32_t, std::unique_ptr<PepperPlayerDelegate>>;
36 PlayersMap players_map_; 38 PlayersMap players_map_;
37 39
38 // Map for whether Pepper players have ever played sound. 40 // Map for whether Pepper players have ever played sound.
39 // Used for recording UMA. 41 // Used for recording UMA.
40 using PlayersPlayedSoundMap = 42 using PlayersPlayedSoundMap =
41 std::map<int32_t, bool>; 43 std::map<int32_t, bool>;
42 PlayersPlayedSoundMap players_played_sound_map_; 44 PlayersPlayedSoundMap players_played_sound_map_;
43 45
44 // Weak reference to WebContents. 46 // Weak reference to WebContents.
45 WebContentsImpl* contents_; 47 WebContentsImpl* contents_;
46 48
47 DISALLOW_COPY_AND_ASSIGN(PepperPlaybackObserver); 49 DISALLOW_COPY_AND_ASSIGN(PepperPlaybackObserver);
48 }; 50 };
49 51
50 } // namespace content 52 } // namespace content
51 53
52 #endif // CONTENT_BROWSER_MEDIA_SESSION_PEPPER_PLAYBACK_OBSERVER_H_ 54 #endif // CONTENT_BROWSER_MEDIA_SESSION_PEPPER_PLAYBACK_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/browser/media/session/pepper_playback_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698