| OLD | NEW |
| 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" |
| 8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 9 #include "chrome/browser/media/media_stream_capture_indicator.h" | 10 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 10 #include "chrome/grit/generated_resources.h" | 11 #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...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 return contents->WasRecentlyAudible(); | 120 AudioStreamMonitor* const audio_stream_monitor = |
| 121 AudioStreamMonitor::FromWebContents(contents); |
| 122 return audio_stream_monitor && audio_stream_monitor->WasRecentlyAudible(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 TabMediaState GetTabMediaStateForContents(content::WebContents* contents) { | 125 TabMediaState GetTabMediaStateForContents(content::WebContents* contents) { |
| 124 if (!contents) | 126 if (!contents) |
| 125 return TAB_MEDIA_STATE_NONE; | 127 return TAB_MEDIA_STATE_NONE; |
| 126 | 128 |
| 127 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 129 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
| 128 MediaCaptureDevicesDispatcher::GetInstance()-> | 130 MediaCaptureDevicesDispatcher::GetInstance()-> |
| 129 GetMediaStreamCaptureIndicator(); | 131 GetMediaStreamCaptureIndicator(); |
| 130 if (indicator.get()) { | 132 if (indicator.get()) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING)); | 202 l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_MEDIA_STATE_CAPTURING)); |
| 201 break; | 203 break; |
| 202 case TAB_MEDIA_STATE_NONE: | 204 case TAB_MEDIA_STATE_NONE: |
| 203 NOTREACHED(); | 205 NOTREACHED(); |
| 204 break; | 206 break; |
| 205 } | 207 } |
| 206 return result; | 208 return result; |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace chrome | 211 } // namespace chrome |
| OLD | NEW |