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

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

Issue 1184953006: Record autoplay disabled by sandbox flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Media element with autoplay seen. 254 // Media element with autoplay seen.
255 AutoplayMediaFound = 0, 255 AutoplayMediaFound = 0,
256 // Autoplay enabled and user stopped media play at any point. 256 // Autoplay enabled and user stopped media play at any point.
257 AutoplayStopped = 1, 257 AutoplayStopped = 1,
258 // Autoplay enabled but user bailed out on media play early. 258 // Autoplay enabled but user bailed out on media play early.
259 AutoplayBailout = 2, 259 AutoplayBailout = 2,
260 // Autoplay disabled but user manually started media. 260 // Autoplay disabled but user manually started media.
261 AutoplayManualStart = 3, 261 AutoplayManualStart = 3,
262 // Autoplay was (re)enabled through a user-gesture triggered load() 262 // Autoplay was (re)enabled through a user-gesture triggered load()
263 AutoplayEnabledThroughLoad = 4, 263 AutoplayEnabledThroughLoad = 4,
264 // Autoplay disabled by sandbox flags.
265 AutoplayDisableddBySandbox = 5,
fs 2015/06/18 08:18:39 Drive-by nit: Disabledd
264 // This enum value must be last. 266 // This enum value must be last.
265 NumberOfAutoplayMetrics, 267 NumberOfAutoplayMetrics,
266 }; 268 };
267 269
268 static void recordAutoplayMetric(AutoplayMetrics metric) 270 static void recordAutoplayMetric(AutoplayMetrics metric)
269 { 271 {
270 Platform::current()->histogramEnumeration("Blink.MediaElement.Autoplay", met ric, NumberOfAutoplayMetrics); 272 Platform::current()->histogramEnumeration("Blink.MediaElement.Autoplay", met ric, NumberOfAutoplayMetrics);
271 } 273 }
272 274
273 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem) 275 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem)
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 shouldUpdateDisplayState = true; 1531 shouldUpdateDisplayState = true;
1530 } 1532 }
1531 1533
1532 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track sAreReady) { 1534 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track sAreReady) {
1533 if (oldState <= HAVE_CURRENT_DATA) { 1535 if (oldState <= HAVE_CURRENT_DATA) {
1534 scheduleEvent(EventTypeNames::canplay); 1536 scheduleEvent(EventTypeNames::canplay);
1535 if (isPotentiallyPlaying) 1537 if (isPotentiallyPlaying)
1536 scheduleEvent(EventTypeNames::playing); 1538 scheduleEvent(EventTypeNames::playing);
1537 } 1539 }
1538 1540
1539 if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(S andboxAutomaticFeatures)) { 1541 if (m_autoplaying && m_paused && autoplay()) {
1540 autoplayMediaEncountered(); 1542 autoplayMediaEncountered();
1541 if (!m_userGestureRequiredForPlay) { 1543
1544 if (document().isSandboxed(SandboxAutomaticFeatures)) {
1545 recordAutoplayMetric(AutoplayDisableddBySandbox);
1546 } else if (!m_userGestureRequiredForPlay) {
1542 m_paused = false; 1547 m_paused = false;
1543 invalidateCachedTime(); 1548 invalidateCachedTime();
1544 scheduleEvent(EventTypeNames::play); 1549 scheduleEvent(EventTypeNames::play);
1545 scheduleEvent(EventTypeNames::playing); 1550 scheduleEvent(EventTypeNames::playing);
1546 } 1551 }
1547 } 1552 }
1548 1553
1549 scheduleEvent(EventTypeNames::canplaythrough); 1554 scheduleEvent(EventTypeNames::canplaythrough);
1550 1555
1551 shouldUpdateDisplayState = true; 1556 shouldUpdateDisplayState = true;
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 3672
3668 #if ENABLE(WEB_AUDIO) 3673 #if ENABLE(WEB_AUDIO)
3669 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3674 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3670 { 3675 {
3671 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) 3676 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider())
3672 audioSourceProvider()->setClient(nullptr); 3677 audioSourceProvider()->setClient(nullptr);
3673 } 3678 }
3674 #endif 3679 #endif
3675 3680
3676 } 3681 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698