The previous implementation is not correct, it depended on the Fullscreen video class, but the PowerSaveBlocker could be used for embedding video or the use case which isn't related to the video at all.

This patch adds new API to PowerSaveBlocker. 

BUG=247892

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=212022

Review URL: https://chromiumcodereview.appspot.com/17175009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212536 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index b5d1eb0c..645923664 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -47,6 +47,7 @@
 class InterstitialPageImpl;
 class JavaBridgeDispatcherHostManager;
 class JavaScriptDialogManager;
+class PowerSaveBlocker;
 class RenderViewHost;
 class RenderViewHostDelegateView;
 class RenderViewHostImpl;
@@ -625,6 +626,11 @@
                        const std::string& frame_name);
   void OnFrameDetached(int64 parent_frame_id, int64 frame_id);
 
+  void OnMediaNotification(int64 player_cookie,
+                           bool has_video,
+                           bool has_audio,
+                           bool is_playing);
+
   // Changes the IsLoading state and notifies delegate as needed
   // |details| is used to provide details on the load that just finished
   // (but can be null if not applicable). Can be overridden.
@@ -742,6 +748,12 @@
   // Removes browser plugin embedder if there is one.
   void RemoveBrowserPluginEmbedder();
 
+  // Clear |render_view_host|'s PowerSaveBlockers.
+  void ClearPowerSaveBlockers(RenderViewHost* render_view_host);
+
+  // Clear all PowerSaveBlockers, leave power_save_blocker_ empty.
+  void ClearAllPowerSaveBlockers();
+
   // Data for core operation ---------------------------------------------------
 
   // Delegate for notifying our owner about stuff. Not owned by us.
@@ -787,6 +799,13 @@
 
   // Helper classes ------------------------------------------------------------
 
+  // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker
+  // pairs. Key is the RenderViewHost, value is the map which maps player_cookie
+  // on to PowerSaveBlocker.
+  typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> >
+      PowerSaveBlockerMap;
+  PowerSaveBlockerMap power_save_blockers_;
+
   // Manages creation and swapping of render views.
   RenderViewHostManager render_manager_;