Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/tabs/tab_utils.cc

Issue 569713002: Revert of Gardening: Revert "Use AudioStreamMonitor to control power save blocking." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.cc ('k') | chrome/chrome_browser.gypi » ('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 (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 #include "chrome/browser/ui/tabs/tab_utils.h" 5 #include "chrome/browser/ui/tabs/tab_utils.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/media/audio_stream_monitor.h"
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 8 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
10 #include "chrome/browser/media/media_stream_capture_indicator.h" 9 #include "chrome/browser/media/media_stream_capture_indicator.h"
11 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "content/public/browser/web_contents.h"
12 #include "grit/theme_resources.h" 12 #include "grit/theme_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/gfx/animation/multi_animation.h" 15 #include "ui/gfx/animation/multi_animation.h"
16 16
17 namespace chrome { 17 namespace chrome {
18 18
19 namespace { 19 namespace {
20 20
21 // Interval between frame updates of the tab indicator animations. This is not 21 // Interval between frame updates of the tab indicator animations. This is not
(...skipping 88 matching lines...)
110 bool is_active_tab) { 110 bool is_active_tab) {
111 if (is_pinned_tab) 111 if (is_pinned_tab)
112 return false; 112 return false;
113 else if (is_active_tab) 113 else if (is_active_tab)
114 return true; 114 return true;
115 else 115 else
116 return capacity >= 3; 116 return capacity >= 3;
117 } 117 }
118 118
119 bool IsPlayingAudio(content::WebContents* contents) { 119 bool IsPlayingAudio(content::WebContents* contents) {
120 AudioStreamMonitor* const audio_stream_monitor = 120 return contents->WasRecentlyAudible();
121 AudioStreamMonitor::FromWebContents(contents);
122 return audio_stream_monitor && audio_stream_monitor->WasRecentlyAudible();
123 } 121 }
124 122
125 TabMediaState GetTabMediaStateForContents(content::WebContents* contents) { 123 TabMediaState GetTabMediaStateForContents(content::WebContents* contents) {
126 if (!contents) 124 if (!contents)
127 return TAB_MEDIA_STATE_NONE; 125 return TAB_MEDIA_STATE_NONE;
128 126
129 scoped_refptr<MediaStreamCaptureIndicator> indicator = 127 scoped_refptr<MediaStreamCaptureIndicator> indicator =
130 MediaCaptureDevicesDispatcher::GetInstance()-> 128 MediaCaptureDevicesDispatcher::GetInstance()->
131 GetMediaStreamCaptureIndicator(); 129 GetMediaStreamCaptureIndicator();
132 if (indicator.get()) { 130 if (indicator.get()) {
(...skipping 69 matching lines...)
202 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING)); 200 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING));
203 break; 201 break;
204 case TAB_MEDIA_STATE_NONE: 202 case TAB_MEDIA_STATE_NONE:
205 NOTREACHED(); 203 NOTREACHED();
206 break; 204 break;
207 } 205 }
208 return result; 206 return result;
209 } 207 }
210 208
211 } // namespace chrome 209 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine