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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
10 #include "chrome/browser/media/media_stream_capture_indicator.h" | 10 #include "chrome/browser/media/media_stream_capture_indicator.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return GetTabMediaIndicatorImage(media_state); | 176 return GetTabMediaIndicatorImage(media_state); |
177 } | 177 } |
178 NOTREACHED(); | 178 NOTREACHED(); |
179 return GetTabMediaIndicatorImage(media_state); | 179 return GetTabMediaIndicatorImage(media_state); |
180 } | 180 } |
181 | 181 |
182 scoped_ptr<gfx::Animation> CreateTabMediaIndicatorFadeAnimation( | 182 scoped_ptr<gfx::Animation> CreateTabMediaIndicatorFadeAnimation( |
183 TabMediaState media_state) { | 183 TabMediaState media_state) { |
184 if (media_state == TAB_MEDIA_STATE_RECORDING || | 184 if (media_state == TAB_MEDIA_STATE_RECORDING || |
185 media_state == TAB_MEDIA_STATE_CAPTURING) { | 185 media_state == TAB_MEDIA_STATE_CAPTURING) { |
186 return TabRecordingIndicatorAnimation::Create().PassAs<gfx::Animation>(); | 186 return TabRecordingIndicatorAnimation::Create(); |
187 } | 187 } |
188 | 188 |
189 // Note: While it seems silly to use a one-part MultiAnimation, it's the only | 189 // Note: While it seems silly to use a one-part MultiAnimation, it's the only |
190 // gfx::Animation implementation that lets us control the frame interval. | 190 // gfx::Animation implementation that lets us control the frame interval. |
191 gfx::MultiAnimation::Parts parts; | 191 gfx::MultiAnimation::Parts parts; |
192 const bool is_for_fade_in = (media_state != TAB_MEDIA_STATE_NONE); | 192 const bool is_for_fade_in = (media_state != TAB_MEDIA_STATE_NONE); |
193 parts.push_back(gfx::MultiAnimation::Part( | 193 parts.push_back(gfx::MultiAnimation::Part( |
194 is_for_fade_in ? kIndicatorFadeInDurationMs : kIndicatorFadeOutDurationMs, | 194 is_for_fade_in ? kIndicatorFadeInDurationMs : kIndicatorFadeOutDurationMs, |
195 gfx::Tween::EASE_IN)); | 195 gfx::Tween::EASE_IN)); |
196 const base::TimeDelta interval = | 196 const base::TimeDelta interval = |
197 base::TimeDelta::FromMilliseconds(kIndicatorFrameIntervalMs); | 197 base::TimeDelta::FromMilliseconds(kIndicatorFrameIntervalMs); |
198 scoped_ptr<gfx::MultiAnimation> animation( | 198 scoped_ptr<gfx::MultiAnimation> animation( |
199 new gfx::MultiAnimation(parts, interval)); | 199 new gfx::MultiAnimation(parts, interval)); |
200 animation->set_continuous(false); | 200 animation->set_continuous(false); |
201 return animation.PassAs<gfx::Animation>(); | 201 return animation.Pass(); |
202 } | 202 } |
203 | 203 |
204 base::string16 AssembleTabTooltipText(const base::string16& title, | 204 base::string16 AssembleTabTooltipText(const base::string16& title, |
205 TabMediaState media_state) { | 205 TabMediaState media_state) { |
206 if (media_state == TAB_MEDIA_STATE_NONE) | 206 if (media_state == TAB_MEDIA_STATE_NONE) |
207 return title; | 207 return title; |
208 | 208 |
209 base::string16 result = title; | 209 base::string16 result = title; |
210 if (!result.empty()) | 210 if (!result.empty()) |
211 result.append(1, '\n'); | 211 result.append(1, '\n'); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 const std::vector<int>& indices) { | 270 const std::vector<int>& indices) { |
271 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); | 271 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); |
272 ++i) { | 272 ++i) { |
273 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) | 273 if (!IsTabAudioMuted(tab_strip.GetWebContentsAt(*i))) |
274 return false; | 274 return false; |
275 } | 275 } |
276 return true; | 276 return true; |
277 } | 277 } |
278 | 278 |
279 } // namespace chrome | 279 } // namespace chrome |
OLD | NEW |