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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 const char* NavigatorWebMIDI::supplementName() | 59 const char* NavigatorWebMIDI::supplementName() |
60 { | 60 { |
61 return "NavigatorWebMIDI"; | 61 return "NavigatorWebMIDI"; |
62 } | 62 } |
63 | 63 |
64 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) | 64 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) |
65 { | 65 { |
66 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); | 66 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); |
67 if (!supplement) { | 67 if (!supplement) { |
68 supplement = new NavigatorWebMIDI(navigator.frame()); | 68 supplement = new NavigatorWebMIDI(navigator.localFrame()); |
69 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 69 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
70 } | 70 } |
71 return *supplement; | 71 return *supplement; |
72 } | 72 } |
73 | 73 |
74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
gator& navigator, const MIDIOptions& options) | 74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
gator& navigator, const MIDIOptions& options) |
75 { | 75 { |
76 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti
ons); | 76 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti
ons); |
77 } | 77 } |
78 | 78 |
79 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons
t MIDIOptions& options) | 79 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons
t MIDIOptions& options) |
80 { | 80 { |
81 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { | 81 if (!localFrame() || localFrame()->document()->activeDOMObjectsAreStopped())
{ |
82 return ScriptPromise::reject(scriptState, toV8(DOMError::create("AbortEr
ror"), scriptState->context()->Global(), scriptState->isolate())); | 82 return ScriptPromise::reject(scriptState, toV8(DOMError::create("AbortEr
ror"), scriptState->context()->Global(), scriptState->isolate())); |
83 } | 83 } |
84 | 84 |
85 return MIDIAccessInitializer::start(scriptState, options); | 85 return MIDIAccessInitializer::start(scriptState, options); |
86 } | 86 } |
87 | 87 |
88 } // namespace blink | 88 } // namespace blink |
OLD | NEW |