OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 #include "bindings/core/v8/Dictionary.h" | 28 #include "bindings/core/v8/Dictionary.h" |
29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
31 #include "bindings/core/v8/ScriptPromiseResolver.h" | 31 #include "bindings/core/v8/ScriptPromiseResolver.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/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
37 #include "core/html/HTMLMediaElement.h" | 37 #include "core/html/HTMLMediaElement.h" |
| 38 #include "core/html/media/AutoplayPolicy.h" |
38 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
39 #include "core/inspector/ConsoleTypes.h" | 40 #include "core/inspector/ConsoleTypes.h" |
40 #include "modules/mediastream/MediaStream.h" | 41 #include "modules/mediastream/MediaStream.h" |
41 #include "modules/webaudio/AnalyserNode.h" | 42 #include "modules/webaudio/AnalyserNode.h" |
42 #include "modules/webaudio/AudioBuffer.h" | 43 #include "modules/webaudio/AudioBuffer.h" |
43 #include "modules/webaudio/AudioBufferCallback.h" | 44 #include "modules/webaudio/AudioBufferCallback.h" |
44 #include "modules/webaudio/AudioBufferSourceNode.h" | 45 #include "modules/webaudio/AudioBufferSourceNode.h" |
45 #include "modules/webaudio/AudioContext.h" | 46 #include "modules/webaudio/AudioContext.h" |
46 #include "modules/webaudio/AudioListener.h" | 47 #include "modules/webaudio/AudioListener.h" |
47 #include "modules/webaudio/AudioNodeInput.h" | 48 #include "modules/webaudio/AudioNodeInput.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 user_gesture_required_(false), | 98 user_gesture_required_(false), |
98 connection_count_(0), | 99 connection_count_(0), |
99 deferred_task_handler_(DeferredTaskHandler::Create()), | 100 deferred_task_handler_(DeferredTaskHandler::Create()), |
100 context_state_(kSuspended), | 101 context_state_(kSuspended), |
101 closed_context_sample_rate_(-1), | 102 closed_context_sample_rate_(-1), |
102 periodic_wave_sine_(nullptr), | 103 periodic_wave_sine_(nullptr), |
103 periodic_wave_square_(nullptr), | 104 periodic_wave_square_(nullptr), |
104 periodic_wave_sawtooth_(nullptr), | 105 periodic_wave_sawtooth_(nullptr), |
105 periodic_wave_triangle_(nullptr), | 106 periodic_wave_triangle_(nullptr), |
106 output_position_() { | 107 output_position_() { |
107 // If mediaPlaybackRequiresUserGesture is enabled, cross origin iframes will | 108 // If the autoplay policy requires a user gesture, cross origin iframes will |
108 // require user gesture for the AudioContext to produce sound. | 109 // require user gesture for the AudioContext to produce sound. This apply even |
109 if (document->GetSettings() && | 110 // if the autoplay policy requires user gesture for top frames. |
110 document->GetSettings()->GetMediaPlaybackRequiresUserGesture() && | 111 if (AutoplayPolicy::GetAutoplayPolicyForDocument(*document) != |
| 112 AutoplayPolicy::Type::kNoUserGestureRequired && |
111 document->GetFrame() && document->GetFrame()->IsCrossOriginSubframe()) { | 113 document->GetFrame() && document->GetFrame()->IsCrossOriginSubframe()) { |
112 autoplay_status_ = AutoplayStatus::kAutoplayStatusFailed; | 114 autoplay_status_ = AutoplayStatus::kAutoplayStatusFailed; |
113 user_gesture_required_ = true; | 115 user_gesture_required_ = true; |
114 } | 116 } |
115 } | 117 } |
116 | 118 |
117 // Constructor for offline (non-realtime) rendering. | 119 // Constructor for offline (non-realtime) rendering. |
118 BaseAudioContext::BaseAudioContext(Document* document, | 120 BaseAudioContext::BaseAudioContext(Document* document, |
119 unsigned number_of_channels, | 121 unsigned number_of_channels, |
120 size_t number_of_frames, | 122 size_t number_of_frames, |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 } | 921 } |
920 | 922 |
921 SecurityOrigin* BaseAudioContext::GetSecurityOrigin() const { | 923 SecurityOrigin* BaseAudioContext::GetSecurityOrigin() const { |
922 if (GetExecutionContext()) | 924 if (GetExecutionContext()) |
923 return GetExecutionContext()->GetSecurityOrigin(); | 925 return GetExecutionContext()->GetSecurityOrigin(); |
924 | 926 |
925 return nullptr; | 927 return nullptr; |
926 } | 928 } |
927 | 929 |
928 } // namespace blink | 930 } // namespace blink |
OLD | NEW |