| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) | 59 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) |
| 60 { | 60 { |
| 61 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); | 61 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); |
| 62 if (!supplement) { | 62 if (!supplement) { |
| 63 supplement = new NavigatorWebMIDI(navigator.frame()); | 63 supplement = new NavigatorWebMIDI(navigator.frame()); |
| 64 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 64 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 65 } | 65 } |
| 66 return *supplement; | 66 return *supplement; |
| 67 } | 67 } |
| 68 | 68 |
| 69 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Di
ctionary& options) | 69 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
gator& navigator, const Dictionary& options) |
| 70 { | 70 { |
| 71 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(options); | 71 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti
ons); |
| 72 } | 72 } |
| 73 | 73 |
| 74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options) | 74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons
t Dictionary& options) |
| 75 { | 75 { |
| 76 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { | 76 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { |
| 77 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(v
8::Isolate::GetCurrent()); | 77 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s
criptState); |
| 78 ScriptPromise promise = resolver->promise(); | 78 ScriptPromise promise = resolver->promise(); |
| 79 // FIXME: Currently this rejection does not work because the context is
stopped. | 79 // FIXME: Currently this rejection does not work because the context is
stopped. |
| 80 resolver->reject(DOMError::create("AbortError")); | 80 resolver->reject(DOMError::create("AbortError")); |
| 81 return promise; | 81 return promise; |
| 82 } | 82 } |
| 83 | 83 |
| 84 return MIDIAccess::request(MIDIOptions(options), frame()->document()); | 84 return MIDIAccess::request(MIDIOptions(options), frame()->document()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace WebCore | 87 } // namespace WebCore |
| OLD | NEW |