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

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 478543003: Use AudioStreamMonitor to control power save blocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move it! Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 virtual int DownloadImage(const GURL& url, 322 virtual int DownloadImage(const GURL& url,
323 bool is_favicon, 323 bool is_favicon,
324 uint32_t max_bitmap_size, 324 uint32_t max_bitmap_size,
325 const ImageDownloadCallback& callback) OVERRIDE; 325 const ImageDownloadCallback& callback) OVERRIDE;
326 virtual bool IsSubframe() const OVERRIDE; 326 virtual bool IsSubframe() const OVERRIDE;
327 virtual void Find(int request_id, 327 virtual void Find(int request_id,
328 const base::string16& search_text, 328 const base::string16& search_text,
329 const blink::WebFindOptions& options) OVERRIDE; 329 const blink::WebFindOptions& options) OVERRIDE;
330 virtual void StopFinding(StopFindAction action) OVERRIDE; 330 virtual void StopFinding(StopFindAction action) OVERRIDE;
331 virtual void InsertCSS(const std::string& css) OVERRIDE; 331 virtual void InsertCSS(const std::string& css) OVERRIDE;
332 virtual bool WasRecentlyAudible() OVERRIDE;
332 #if defined(OS_ANDROID) 333 #if defined(OS_ANDROID)
333 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() 334 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
334 OVERRIDE; 335 OVERRIDE;
335 virtual WebContentsAndroid* GetWebContentsAndroid(); 336 virtual WebContentsAndroid* GetWebContentsAndroid();
336 #elif defined(OS_MACOSX) 337 #elif defined(OS_MACOSX)
337 virtual void SetAllowOtherViews(bool allow) OVERRIDE; 338 virtual void SetAllowOtherViews(bool allow) OVERRIDE;
338 virtual bool GetAllowOtherViews() OVERRIDE; 339 virtual bool GetAllowOtherViews() OVERRIDE;
339 #endif 340 #endif
340 341
341 // Implementation of PageNavigator. 342 // Implementation of PageNavigator.
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 896
896 // TODO(creis): This should take in a FrameTreeNode to know which node's 897 // TODO(creis): This should take in a FrameTreeNode to know which node's
897 // render manager to return. For now, we just return the root's. 898 // render manager to return. For now, we just return the root's.
898 RenderFrameHostManager* GetRenderManager() const; 899 RenderFrameHostManager* GetRenderManager() const;
899 900
900 RenderViewHostImpl* GetRenderViewHostImpl(); 901 RenderViewHostImpl* GetRenderViewHostImpl();
901 902
902 // Removes browser plugin embedder if there is one. 903 // Removes browser plugin embedder if there is one.
903 void RemoveBrowserPluginEmbedder(); 904 void RemoveBrowserPluginEmbedder();
904 905
905 // Clear |render_frame_host|'s PowerSaveBlockers. 906 // Clear |render_frame_host|'s tracking entry for |power_save_blocker_|.
906 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); 907 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host);
907 908
908 // Clear all PowerSaveBlockers, leave |power_save_blocker_| empty. 909 // Clear tracking entries for all RenderFrameHosts, clears
910 // |power_save_blocker_|.
909 void ClearAllPowerSaveBlockers(); 911 void ClearAllPowerSaveBlockers();
910 912
913 // Creates |power_save_blocker_|; must only be called if |power_save_blocker_|
914 // is NULL and |active_media_players_| is non-empty.
915 void CreatePowerSaveBlocker();
916
911 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView(). 917 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
912 gfx::Size GetSizeForNewRenderView(); 918 gfx::Size GetSizeForNewRenderView();
913 919
914 void OnFrameRemoved(RenderFrameHost* render_frame_host); 920 void OnFrameRemoved(RenderFrameHost* render_frame_host);
915 921
916 // Helper method that's called whenever |preferred_size_| or 922 // Helper method that's called whenever |preferred_size_| or
917 // |preferred_size_for_capture_| changes, to propagate the new value to the 923 // |preferred_size_for_capture_| changes, to propagate the new value to the
918 // |delegate_|. 924 // |delegate_|.
919 void OnPreferredSizeChanged(const gfx::Size& old_size); 925 void OnPreferredSizeChanged(const gfx::Size& old_size);
920 926
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 // is closed. 972 // is closed.
967 bool created_with_opener_; 973 bool created_with_opener_;
968 974
969 #if defined(OS_WIN) 975 #if defined(OS_WIN)
970 gfx::NativeViewAccessible accessible_parent_; 976 gfx::NativeViewAccessible accessible_parent_;
971 #endif 977 #endif
972 978
973 // Helper classes ------------------------------------------------------------ 979 // Helper classes ------------------------------------------------------------
974 980
975 #if !defined(OS_CHROMEOS) 981 #if !defined(OS_CHROMEOS)
976 // Maps the RenderFrameHost to its media_player_cookie and PowerSaveBlocker 982 typedef std::map<uintptr_t, int> ActiveMediaPlayerMap;
977 // pairs. Key is the RenderFrameHost, value is the map which maps 983 ActiveMediaPlayerMap active_media_players_;
978 // player_cookie on to PowerSaveBlocker. 984 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
979 //
980 // ChromeOS does its own detection of audio and video.
981 typedef base::ScopedPtrHashMap<int64, PowerSaveBlocker>
982 PowerSaveBlockerMapEntry;
983 typedef base::ScopedPtrHashMap<uintptr_t, PowerSaveBlockerMapEntry>
984 PowerSaveBlockerMap;
985 PowerSaveBlockerMap power_save_blockers_;
986 #endif 985 #endif
987 986
988 // Manages the frame tree of the page and process swaps in each node. 987 // Manages the frame tree of the page and process swaps in each node.
989 FrameTree frame_tree_; 988 FrameTree frame_tree_;
990 989
991 // SavePackage, lazily created. 990 // SavePackage, lazily created.
992 scoped_refptr<SavePackage> save_package_; 991 scoped_refptr<SavePackage> save_package_;
993 992
994 // Data for loading state ---------------------------------------------------- 993 // Data for loading state ----------------------------------------------------
995 994
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 // The accessibility mode for all frames. This is queried when each frame 1199 // The accessibility mode for all frames. This is queried when each frame
1201 // is created, and broadcast to all frames when it changes. 1200 // is created, and broadcast to all frames when it changes.
1202 AccessibilityMode accessibility_mode_; 1201 AccessibilityMode accessibility_mode_;
1203 1202
1204 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1203 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1205 }; 1204 };
1206 1205
1207 } // namespace content 1206 } // namespace content
1208 1207
1209 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1208 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698