Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2018813002: Split Media.Controls.Show in .Video and .Audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 } 2183 }
2184 2184
2185 void HTMLMediaElement::setLoop(bool b) 2185 void HTMLMediaElement::setLoop(bool b)
2186 { 2186 {
2187 DVLOG(MEDIA_LOG_LEVEL) << "setLoop(" << (void*)this << ", " << boolString(b) << ")"; 2187 DVLOG(MEDIA_LOG_LEVEL) << "setLoop(" << (void*)this << ", " << boolString(b) << ")";
2188 setBooleanAttribute(loopAttr, b); 2188 setBooleanAttribute(loopAttr, b);
2189 } 2189 }
2190 2190
2191 bool HTMLMediaElement::shouldShowControls(const RecordMetricsBehavior recordMetr ics) const 2191 bool HTMLMediaElement::shouldShowControls(const RecordMetricsBehavior recordMetr ics) const
2192 { 2192 {
2193 DEFINE_STATIC_LOCAL(EnumerationHistogram, showControlsHistogram, ("Media.Con trols.Show", MediaControlsShowMax));
2194
2195 if (fastHasAttribute(controlsAttr)) { 2193 if (fastHasAttribute(controlsAttr)) {
2196 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2194 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2197 showControlsHistogram.count(MediaControlsShowAttribute); 2195 showControlsHistogram().count(MediaControlsShowAttribute);
2198 return true; 2196 return true;
2199 } 2197 }
2200 2198
2201 if (isFullscreen()) { 2199 if (isFullscreen()) {
2202 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2200 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2203 showControlsHistogram.count(MediaControlsShowFullscreen); 2201 showControlsHistogram().count(MediaControlsShowFullscreen);
2204 return true; 2202 return true;
2205 } 2203 }
2206 2204
2207 LocalFrame* frame = document().frame(); 2205 LocalFrame* frame = document().frame();
2208 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) { 2206 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) {
2209 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2207 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2210 showControlsHistogram.count(MediaControlsShowNoScript); 2208 showControlsHistogram().count(MediaControlsShowNoScript);
2211 return true; 2209 return true;
2212 } 2210 }
2213 2211
2214 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2212 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2215 showControlsHistogram.count(MediaControlsShowNotShown); 2213 showControlsHistogram().count(MediaControlsShowNotShown);
2216 return false; 2214 return false;
2217 } 2215 }
2218 2216
2219 double HTMLMediaElement::volume() const 2217 double HTMLMediaElement::volume() const
2220 { 2218 {
2221 return m_volume; 2219 return m_volume;
2222 } 2220 }
2223 2221
2224 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) 2222 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState)
2225 { 2223 {
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
3752 void HTMLMediaElement::rejectPlayPromises(ExceptionCode code, const String& mess age) 3750 void HTMLMediaElement::rejectPlayPromises(ExceptionCode code, const String& mess age)
3753 { 3751 {
3754 ASSERT(code == AbortError || code == NotSupportedError); 3752 ASSERT(code == AbortError || code == NotSupportedError);
3755 3753
3756 for (auto& resolver: m_playResolvers) 3754 for (auto& resolver: m_playResolvers)
3757 resolver->reject(DOMException::create(code, message)); 3755 resolver->reject(DOMException::create(code, message));
3758 3756
3759 m_playResolvers.clear(); 3757 m_playResolvers.clear();
3760 } 3758 }
3761 3759
3760 EnumerationHistogram& HTMLMediaElement::showControlsHistogram() const
3761 {
3762 if (isHTMLVideoElement()) {
3763 DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("Media.Controls.Sh ow.Video", MediaControlsShowMax));
3764 return histogram;
3765 }
3766
3767 DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("Media.Controls.Show.A udio", MediaControlsShowMax));
3768 return histogram;
3769 }
3770
3762 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3771 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3763 { 3772 {
3764 if (!ThreadHeap::isHeapObjectAlive(m_audioSourceNode)) { 3773 if (!ThreadHeap::isHeapObjectAlive(m_audioSourceNode)) {
3765 getAudioSourceProvider().setClient(nullptr); 3774 getAudioSourceProvider().setClient(nullptr);
3766 m_audioSourceNode = nullptr; 3775 m_audioSourceNode = nullptr;
3767 } 3776 }
3768 } 3777 }
3769 3778
3770 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) 3779 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider)
3771 { 3780 {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3869 3878
3870 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3879 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3871 { 3880 {
3872 IntRect result; 3881 IntRect result;
3873 if (LayoutObject* object = m_element->layoutObject()) 3882 if (LayoutObject* object = m_element->layoutObject())
3874 result = object->absoluteBoundingBoxRect(); 3883 result = object->absoluteBoundingBoxRect();
3875 return result; 3884 return result;
3876 } 3885 }
3877 3886
3878 } // namespace blink 3887 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698