Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2253 | 2253 |
| 2254 bool HTMLMediaElement::muted() const | 2254 bool HTMLMediaElement::muted() const |
| 2255 { | 2255 { |
| 2256 return m_muted; | 2256 return m_muted; |
| 2257 } | 2257 } |
| 2258 | 2258 |
| 2259 void HTMLMediaElement::setMuted(bool muted) | 2259 void HTMLMediaElement::setMuted(bool muted) |
| 2260 { | 2260 { |
| 2261 DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(m uted) << ")"; | 2261 DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(m uted) << ")"; |
| 2262 | 2262 |
| 2263 if (UserGestureIndicator::processingUserGesture()) | |
| 2264 unlockUserGesture(); | |
| 2265 | |
| 2263 if (m_muted == muted) | 2266 if (m_muted == muted) |
| 2264 return; | 2267 return; |
| 2265 | 2268 |
| 2266 m_muted = muted; | 2269 m_muted = muted; |
| 2267 m_autoplayHelper->mutedChanged(); | 2270 m_autoplayHelper->mutedChanged(); |
| 2268 | 2271 |
| 2269 updateVolume(); | 2272 updateVolume(); |
| 2270 | 2273 |
| 2271 if (muted) | 2274 if (muted) |
| 2272 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _On")); | 2275 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _On")); |
| 2273 else | 2276 else |
| 2274 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _Off")); | 2277 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _Off")); |
| 2275 | 2278 |
| 2276 scheduleEvent(EventTypeNames::volumechange); | 2279 scheduleEvent(EventTypeNames::volumechange); |
| 2280 | |
| 2281 // Pause the element when unmuting if there was no user gesture. | |
|
mlamouri (slow - plz ping)
2016/06/09 17:43:16
nit: s/if there was no user gesture./if the elemen
| |
| 2282 if (!muted && isGestureNeededForPlayback()) | |
| 2283 pause(); | |
| 2277 } | 2284 } |
| 2278 | 2285 |
| 2279 void HTMLMediaElement::updateVolume() | 2286 void HTMLMediaElement::updateVolume() |
| 2280 { | 2287 { |
| 2281 if (webMediaPlayer()) | 2288 if (webMediaPlayer()) |
| 2282 webMediaPlayer()->setVolume(effectiveMediaVolume()); | 2289 webMediaPlayer()->setVolume(effectiveMediaVolume()); |
| 2283 | 2290 |
| 2284 if (mediaControls()) | 2291 if (mediaControls()) |
| 2285 mediaControls()->updateVolume(); | 2292 mediaControls()->updateVolume(); |
| 2286 } | 2293 } |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3926 | 3933 |
| 3927 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst | 3934 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst |
| 3928 { | 3935 { |
| 3929 IntRect result; | 3936 IntRect result; |
| 3930 if (LayoutObject* object = m_element->layoutObject()) | 3937 if (LayoutObject* object = m_element->layoutObject()) |
| 3931 result = object->absoluteBoundingBoxRect(); | 3938 result = object->absoluteBoundingBoxRect(); |
| 3932 return result; | 3939 return result; |
| 3933 } | 3940 } |
| 3934 | 3941 |
| 3935 } // namespace blink | 3942 } // namespace blink |
| OLD | NEW |