Index: content/browser/web_contents/web_contents_impl.h |
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h |
index 922829cfb74239d69953ad80bc5301ab5154648e..2e3bc9655051a83335292c6310c1525dcc5f4137 100644 |
--- a/content/browser/web_contents/web_contents_impl.h |
+++ b/content/browser/web_contents/web_contents_impl.h |
@@ -329,6 +329,7 @@ class CONTENT_EXPORT WebContentsImpl |
const blink::WebFindOptions& options) OVERRIDE; |
virtual void StopFinding(StopFindAction action) OVERRIDE; |
virtual void InsertCSS(const std::string& css) OVERRIDE; |
+ virtual bool WasRecentlyAudible() OVERRIDE; |
#if defined(OS_ANDROID) |
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() |
OVERRIDE; |
@@ -902,12 +903,17 @@ class CONTENT_EXPORT WebContentsImpl |
// Removes browser plugin embedder if there is one. |
void RemoveBrowserPluginEmbedder(); |
- // Clear |render_frame_host|'s PowerSaveBlockers. |
+ // Clear |render_frame_host|'s tracking entry for |power_save_blocker_|. |
void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); |
- // Clear all PowerSaveBlockers, leave |power_save_blocker_| empty. |
+ // Clear tracking entries for all RenderFrameHosts, clears |
+ // |power_save_blocker_|. |
void ClearAllPowerSaveBlockers(); |
+ // Creates |power_save_blocker_|; must only be called if |power_save_blocker_| |
+ // is NULL and |active_media_players_| is non-empty. |
+ void CreatePowerSaveBlocker(); |
+ |
// Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView(). |
gfx::Size GetSizeForNewRenderView(); |
@@ -973,16 +979,9 @@ class CONTENT_EXPORT WebContentsImpl |
// Helper classes ------------------------------------------------------------ |
#if !defined(OS_CHROMEOS) |
- // Maps the RenderFrameHost to its media_player_cookie and PowerSaveBlocker |
- // pairs. Key is the RenderFrameHost, value is the map which maps |
- // player_cookie on to PowerSaveBlocker. |
- // |
- // ChromeOS does its own detection of audio and video. |
- typedef base::ScopedPtrHashMap<int64, PowerSaveBlocker> |
- PowerSaveBlockerMapEntry; |
- typedef base::ScopedPtrHashMap<uintptr_t, PowerSaveBlockerMapEntry> |
- PowerSaveBlockerMap; |
- PowerSaveBlockerMap power_save_blockers_; |
+ typedef std::map<uintptr_t, int> ActiveMediaPlayerMap; |
+ ActiveMediaPlayerMap active_media_players_; |
+ scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; |
#endif |
// Manages the frame tree of the page and process swaps in each node. |