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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 #include "public/platform/WebInbandTextTrack.h" | 82 #include "public/platform/WebInbandTextTrack.h" |
| 83 #include "wtf/CurrentTime.h" | 83 #include "wtf/CurrentTime.h" |
| 84 #include "wtf/MainThread.h" | 84 #include "wtf/MainThread.h" |
| 85 #include "wtf/MathExtras.h" | 85 #include "wtf/MathExtras.h" |
| 86 #include "wtf/text/CString.h" | 86 #include "wtf/text/CString.h" |
| 87 #include <limits> | 87 #include <limits> |
| 88 | 88 |
| 89 | 89 |
| 90 namespace blink { | 90 namespace blink { |
| 91 | 91 |
| 92 namespace { | |
| 93 | |
| 94 enum DefaultControlsShow { | |
|
philipj_slow
2016/02/16 06:20:27
I'd call it MediaControls, because these are the o
mlamouri (slow - plz ping)
2016/02/18 15:49:31
Done.
| |
| 95 DefaultControlsShowAttribute = 0, | |
| 96 DefaultControlsShowFullscreen, | |
| 97 DefaultControlsShowNoScript, | |
| 98 DefaultControlsShowNone, | |
| 99 DefaultControlsShowMax | |
| 100 }; | |
| 101 | |
| 102 } // anonymous namespace | |
|
philipj_slow
2016/02/16 06:20:27
Move the below static things into the anonymous na
mlamouri (slow - plz ping)
2016/02/18 15:49:31
I did that here: https://codereview.chromium.org/1
| |
| 103 | |
| 92 #if !LOG_DISABLED | 104 #if !LOG_DISABLED |
| 93 static String urlForLoggingMedia(const KURL& url) | 105 static String urlForLoggingMedia(const KURL& url) |
| 94 { | 106 { |
| 95 static const unsigned maximumURLLengthForLogging = 128; | 107 static const unsigned maximumURLLengthForLogging = 128; |
| 96 | 108 |
| 97 if (url.string().length() < maximumURLLengthForLogging) | 109 if (url.string().length() < maximumURLLengthForLogging) |
| 98 return url.string(); | 110 return url.string(); |
| 99 return url.string().substring(0, maximumURLLengthForLogging) + "..."; | 111 return url.string().substring(0, maximumURLLengthForLogging) + "..."; |
| 100 } | 112 } |
| 101 | 113 |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2084 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 2096 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 2085 return true; | 2097 return true; |
| 2086 | 2098 |
| 2087 // Always show controls when in full screen mode. | 2099 // Always show controls when in full screen mode. |
| 2088 if (isFullscreen()) | 2100 if (isFullscreen()) |
| 2089 return true; | 2101 return true; |
| 2090 | 2102 |
| 2091 return fastHasAttribute(controlsAttr); | 2103 return fastHasAttribute(controlsAttr); |
| 2092 } | 2104 } |
| 2093 | 2105 |
| 2106 void HTMLMediaElement::recordShowControls() const | |
| 2107 { | |
| 2108 DEFINE_STATIC_LOCAL(EnumerationHistogram, showControlsHistogram, ("Media.Con trols.Show", DefaultControlsShowMax)); | |
| 2109 | |
| 2110 if (fastHasAttribute(controlsAttr)) { | |
|
philipj_slow
2016/02/16 06:20:27
Duplicating the conditions of shouldShowControls()
mlamouri (slow - plz ping)
2016/02/18 15:49:31
Fixed. I know have an internal show controls that
| |
| 2111 showControlsHistogram.count(DefaultControlsShowAttribute); | |
| 2112 return; | |
| 2113 } | |
| 2114 | |
| 2115 if (isFullscreen()) { | |
| 2116 showControlsHistogram.count(DefaultControlsShowFullscreen); | |
| 2117 return; | |
| 2118 } | |
| 2119 | |
| 2120 LocalFrame* frame = document().frame(); | |
| 2121 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) { | |
| 2122 showControlsHistogram.count(DefaultControlsShowNoScript); | |
| 2123 return; | |
| 2124 } | |
| 2125 | |
| 2126 ASSERT(!shouldShowControls()); | |
| 2127 showControlsHistogram.count(DefaultControlsShowNone); | |
| 2128 } | |
| 2129 | |
| 2094 double HTMLMediaElement::volume() const | 2130 double HTMLMediaElement::volume() const |
| 2095 { | 2131 { |
| 2096 return m_volume; | 2132 return m_volume; |
| 2097 } | 2133 } |
| 2098 | 2134 |
| 2099 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) | 2135 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) |
| 2100 { | 2136 { |
| 2101 WTF_LOG(Media, "HTMLMediaElement::setVolume(%p, %f)", this, vol); | 2137 WTF_LOG(Media, "HTMLMediaElement::setVolume(%p, %f)", this, vol); |
| 2102 | 2138 |
| 2103 if (m_volume == vol) | 2139 if (m_volume == vol) |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3336 void HTMLMediaElement::configureMediaControls() | 3372 void HTMLMediaElement::configureMediaControls() |
| 3337 { | 3373 { |
| 3338 if (!inDocument()) { | 3374 if (!inDocument()) { |
| 3339 if (mediaControls()) | 3375 if (mediaControls()) |
| 3340 mediaControls()->hide(); | 3376 mediaControls()->hide(); |
| 3341 return; | 3377 return; |
| 3342 } | 3378 } |
| 3343 | 3379 |
| 3344 ensureMediaControls(); | 3380 ensureMediaControls(); |
| 3345 mediaControls()->reset(); | 3381 mediaControls()->reset(); |
| 3382 | |
| 3383 recordShowControls(); | |
| 3346 if (shouldShowControls()) | 3384 if (shouldShowControls()) |
| 3347 mediaControls()->show(); | 3385 mediaControls()->show(); |
| 3348 else | 3386 else |
| 3349 mediaControls()->hide(); | 3387 mediaControls()->hide(); |
| 3350 } | 3388 } |
| 3351 | 3389 |
| 3352 CueTimeline& HTMLMediaElement::cueTimeline() | 3390 CueTimeline& HTMLMediaElement::cueTimeline() |
| 3353 { | 3391 { |
| 3354 if (!m_cueTimeline) | 3392 if (!m_cueTimeline) |
| 3355 m_cueTimeline = adoptPtrWillBeNoop(new CueTimeline(*this)); | 3393 m_cueTimeline = adoptPtrWillBeNoop(new CueTimeline(*this)); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3625 { | 3663 { |
| 3626 visitor->trace(m_client); | 3664 visitor->trace(m_client); |
| 3627 } | 3665 } |
| 3628 | 3666 |
| 3629 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3667 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3630 { | 3668 { |
| 3631 visitor->trace(m_client); | 3669 visitor->trace(m_client); |
| 3632 } | 3670 } |
| 3633 | 3671 |
| 3634 } // namespace blink | 3672 } // namespace blink |
| OLD | NEW |