| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : DOMWindowProperty(frame) | 46 : DOMWindowProperty(frame) |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 NavigatorWebMIDI::~NavigatorWebMIDI() | 50 NavigatorWebMIDI::~NavigatorWebMIDI() |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 DEFINE_TRACE(NavigatorWebMIDI) | 54 DEFINE_TRACE(NavigatorWebMIDI) |
| 55 { | 55 { |
| 56 HeapSupplement<Navigator>::trace(visitor); | 56 Supplement<Navigator>::trace(visitor); |
| 57 DOMWindowProperty::trace(visitor); | 57 DOMWindowProperty::trace(visitor); |
| 58 } | 58 } |
| 59 | 59 |
| 60 const char* NavigatorWebMIDI::supplementName() | 60 const char* NavigatorWebMIDI::supplementName() |
| 61 { | 61 { |
| 62 return "NavigatorWebMIDI"; | 62 return "NavigatorWebMIDI"; |
| 63 } | 63 } |
| 64 | 64 |
| 65 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) | 65 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) |
| 66 { | 66 { |
| 67 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(HeapSupplement
<Navigator>::from(navigator, supplementName())); | 67 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(Supplement<Nav
igator>::from(navigator, supplementName())); |
| 68 if (!supplement) { | 68 if (!supplement) { |
| 69 supplement = new NavigatorWebMIDI(navigator.frame()); | 69 supplement = new NavigatorWebMIDI(navigator.frame()); |
| 70 provideTo(navigator, supplementName(), supplement); | 70 provideTo(navigator, supplementName(), supplement); |
| 71 } | 71 } |
| 72 return *supplement; | 72 return *supplement; |
| 73 } | 73 } |
| 74 | 74 |
| 75 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
gator& navigator, const MIDIOptions& options) | 75 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
gator& navigator, const MIDIOptions& options) |
| 76 { | 76 { |
| 77 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti
ons); | 77 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti
ons); |
| 78 } | 78 } |
| 79 | 79 |
| 80 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons
t MIDIOptions& options) | 80 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons
t MIDIOptions& options) |
| 81 { | 81 { |
| 82 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { | 82 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { |
| 83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(AbortError, "The frame is not working.")); | 83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(AbortError, "The frame is not working.")); |
| 84 } | 84 } |
| 85 | 85 |
| 86 UseCounter::countCrossOriginIframe(*frame()->document(), UseCounter::Request
MIDIAccessIframe); | 86 UseCounter::countCrossOriginIframe(*frame()->document(), UseCounter::Request
MIDIAccessIframe); |
| 87 return MIDIAccessInitializer::start(scriptState, options); | 87 return MIDIAccessInitializer::start(scriptState, options); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |