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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp

Issue 2311233002: Warn about Web Audio without user gesture on Android no longer allowed on cross origin iframes. (Closed)
Patch Set: Created 4 years, 3 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google 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 15 matching lines...) Expand all
26 26
27 #include "bindings/core/v8/Dictionary.h" 27 #include "bindings/core/v8/Dictionary.h"
28 #include "bindings/core/v8/ExceptionMessages.h" 28 #include "bindings/core/v8/ExceptionMessages.h"
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "bindings/core/v8/ScriptPromiseResolver.h" 30 #include "bindings/core/v8/ScriptPromiseResolver.h"
31 #include "bindings/core/v8/ScriptState.h" 31 #include "bindings/core/v8/ScriptState.h"
32 #include "core/dom/DOMException.h" 32 #include "core/dom/DOMException.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "core/dom/ExecutionContextTask.h" 35 #include "core/dom/ExecutionContextTask.h"
36 #include "core/frame/Deprecation.h"
36 #include "core/frame/Settings.h" 37 #include "core/frame/Settings.h"
37 #include "core/html/HTMLMediaElement.h" 38 #include "core/html/HTMLMediaElement.h"
38 #include "modules/mediastream/MediaStream.h" 39 #include "modules/mediastream/MediaStream.h"
39 #include "modules/webaudio/AnalyserNode.h" 40 #include "modules/webaudio/AnalyserNode.h"
40 #include "modules/webaudio/AudioBuffer.h" 41 #include "modules/webaudio/AudioBuffer.h"
41 #include "modules/webaudio/AudioBufferCallback.h" 42 #include "modules/webaudio/AudioBufferCallback.h"
42 #include "modules/webaudio/AudioBufferSourceNode.h" 43 #include "modules/webaudio/AudioBufferSourceNode.h"
43 #include "modules/webaudio/AudioContext.h" 44 #include "modules/webaudio/AudioContext.h"
44 #include "modules/webaudio/AudioListener.h" 45 #include "modules/webaudio/AudioListener.h"
45 #include "modules/webaudio/AudioNodeInput.h" 46 #include "modules/webaudio/AudioNodeInput.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 { 547 {
547 DEFINE_STATIC_LOCAL(EnumerationHistogram, userGestureHistogram, ("WebAudio.U serGesture", UserGestureRecordMax)); 548 DEFINE_STATIC_LOCAL(EnumerationHistogram, userGestureHistogram, ("WebAudio.U serGesture", UserGestureRecordMax));
548 549
549 if (!m_userGestureRequired) { 550 if (!m_userGestureRequired) {
550 if (UserGestureIndicator::processingUserGesture()) 551 if (UserGestureIndicator::processingUserGesture())
551 userGestureHistogram.count(UserGestureNotRequiredAndAvailable); 552 userGestureHistogram.count(UserGestureNotRequiredAndAvailable);
552 else 553 else
553 userGestureHistogram.count(UserGestureNotRequiredAndNotAvailable); 554 userGestureHistogram.count(UserGestureNotRequiredAndNotAvailable);
554 return; 555 return;
555 } 556 }
557
558 DCHECK(m_userGestureRequired);
Raymond Toy 2016/09/06 15:32:32 Don't quite understand why m_userGestureRequired h
mlamouri (slow - plz ping) 2016/09/06 15:43:00 It always return :) I added the DCHECK() because
Raymond Toy 2016/09/06 15:44:56 Oh, duh! I read the return as inside the else. lg
556 if (!UserGestureIndicator::processingUserGesture()) { 559 if (!UserGestureIndicator::processingUserGesture()) {
557 userGestureHistogram.count(UserGestureRequiredAndNotAvailable); 560 userGestureHistogram.count(UserGestureRequiredAndNotAvailable);
561
562 Document* document = toDocument(getExecutionContext());
563 if (document)
564 Deprecation::countDeprecationCrossOriginIframe(*document, UseCounter ::WebAudioAutoplayCrossOriginIframe);
565
558 return; 566 return;
559 } 567 }
560 userGestureHistogram.count(UserGestureRequiredAndAvailable); 568 userGestureHistogram.count(UserGestureRequiredAndAvailable);
561 m_userGestureRequired = false; 569 m_userGestureRequired = false;
562 } 570 }
563 571
564 String BaseAudioContext::state() const 572 String BaseAudioContext::state() const
565 { 573 {
566 // These strings had better match the strings for AudioContextState in Audio Context.idl. 574 // These strings had better match the strings for AudioContextState in Audio Context.idl.
567 switch (m_contextState) { 575 switch (m_contextState) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 839
832 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const 840 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const
833 { 841 {
834 if (getExecutionContext()) 842 if (getExecutionContext())
835 return getExecutionContext()->getSecurityOrigin(); 843 return getExecutionContext()->getSecurityOrigin();
836 844
837 return nullptr; 845 return nullptr;
838 } 846 }
839 847
840 } // namespace blink 848 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698