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

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

Issue 2314903002: Web Audio: when media playback requires a user gesture, apply rule to cross origin iframes. (Closed)
Patch Set: move click simulation to top frame Created 4 years, 2 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 finish(); 125 finish();
126 } 126 }
127 127
128 return; 128 return;
129 } 129 }
130 130
131 void AudioScheduledSourceHandler::start(double when, ExceptionState& exceptionSt ate) 131 void AudioScheduledSourceHandler::start(double when, ExceptionState& exceptionSt ate)
132 { 132 {
133 DCHECK(isMainThread()); 133 DCHECK(isMainThread());
134 134
135 context()->recordUserGestureState(); 135 // TODO(mlamouri): record when this is called with a user gesture and could
136 // have started the AudioContext if following Safari iOS rules.
136 137
137 if (playbackState() != UNSCHEDULED_STATE) { 138 if (playbackState() != UNSCHEDULED_STATE) {
138 exceptionState.throwDOMException( 139 exceptionState.throwDOMException(
139 InvalidStateError, 140 InvalidStateError,
140 "cannot call start more than once."); 141 "cannot call start more than once.");
141 return; 142 return;
142 } 143 }
143 144
144 if (when < 0) { 145 if (when < 0) {
145 exceptionState.throwDOMException( 146 exceptionState.throwDOMException(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // playback state if the context is closed. 273 // playback state if the context is closed.
273 if (context()->isContextClosed()) 274 if (context()->isContextClosed())
274 return false; 275 return false;
275 276
276 // If a node is scheduled or playing, do not collect the node prematurely 277 // If a node is scheduled or playing, do not collect the node prematurely
277 // even its reference is out of scope. Then fire onended event if assigned. 278 // even its reference is out of scope. Then fire onended event if assigned.
278 return audioScheduledSourceHandler().isPlayingOrScheduled(); 279 return audioScheduledSourceHandler().isPlayingOrScheduled();
279 } 280 }
280 281
281 } // namespace blink 282 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698