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

Side by Side Diff: content/browser/media/media_web_contents_observer.h

Issue 1810213002: media: Allow WMPI to send playing started notification while playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/media/media_web_contents_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_MEDIA_WEB_CONTENTS_OBSERVER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_
6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ 6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <vector>
13 12
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
16 #include "content/browser/media/session/media_session_controllers_manager.h" 15 #include "content/browser/media/session/media_session_controllers_manager.h"
17 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
18 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
19 18
20 namespace content { 19 namespace content {
21 20
22 class PowerSaveBlocker; 21 class PowerSaveBlocker;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Creates an audio or video power save blocker respectively. 71 // Creates an audio or video power save blocker respectively.
73 void CreateAudioPowerSaveBlocker(); 72 void CreateAudioPowerSaveBlocker();
74 void CreateVideoPowerSaveBlocker(); 73 void CreateVideoPowerSaveBlocker();
75 74
76 // Releases the audio power save blockers if |active_audio_players_| is empty. 75 // Releases the audio power save blockers if |active_audio_players_| is empty.
77 // Likewise, releases the video power save blockers if |active_video_players_| 76 // Likewise, releases the video power save blockers if |active_video_players_|
78 // is empty. 77 // is empty.
79 void MaybeReleasePowerSaveBlockers(); 78 void MaybeReleasePowerSaveBlockers();
80 79
81 // Helper methods for adding or removing player entries in |player_map|. 80 // Helper methods for adding or removing player entries in |player_map|.
82 using PlayerList = std::vector<int>; 81 using PlayerSet = std::set<int>;
83 using ActiveMediaPlayerMap = std::map<RenderFrameHost*, PlayerList>; 82 using ActiveMediaPlayerMap = std::map<RenderFrameHost*, PlayerSet>;
84 void AddMediaPlayerEntry(const MediaPlayerId& id, 83 void AddMediaPlayerEntry(const MediaPlayerId& id,
85 ActiveMediaPlayerMap* player_map); 84 ActiveMediaPlayerMap* player_map);
86 // Returns true if an entry is actually removed. 85 // Returns true if an entry is actually removed.
87 bool RemoveMediaPlayerEntry(const MediaPlayerId& id, 86 bool RemoveMediaPlayerEntry(const MediaPlayerId& id,
88 ActiveMediaPlayerMap* player_map); 87 ActiveMediaPlayerMap* player_map);
89 // Removes all entries from |player_map| for |render_frame_host|. Removed 88 // Removes all entries from |player_map| for |render_frame_host|. Removed
90 // entries are added to |removed_players|. 89 // entries are added to |removed_players|.
91 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host, 90 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host,
92 ActiveMediaPlayerMap* player_map, 91 ActiveMediaPlayerMap* player_map,
93 std::set<MediaPlayerId>* removed_players); 92 std::set<MediaPlayerId>* removed_players);
94 93
95 // Tracking variables and associated power save blockers for media playback. 94 // Tracking variables and associated power save blockers for media playback.
96 ActiveMediaPlayerMap active_audio_players_; 95 ActiveMediaPlayerMap active_audio_players_;
97 ActiveMediaPlayerMap active_video_players_; 96 ActiveMediaPlayerMap active_video_players_;
98 scoped_ptr<PowerSaveBlocker> audio_power_save_blocker_; 97 scoped_ptr<PowerSaveBlocker> audio_power_save_blocker_;
99 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; 98 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_;
100 99
101 MediaSessionControllersManager session_controllers_manager_; 100 MediaSessionControllersManager session_controllers_manager_;
102 101
103 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); 102 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver);
104 }; 103 };
105 104
106 } // namespace content 105 } // namespace content
107 106
108 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ 107 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/media_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698