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

Side by Side Diff: Source/modules/webmidi/NavigatorWebMIDI.cpp

Issue 547383004: WebMIDI: Add MIDIOptions dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add assertion Created 6 years, 3 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
« no previous file with comments | « Source/modules/webmidi/NavigatorWebMIDI.h ('k') | Source/modules/webmidi/NavigatorWebMIDI.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) 63 NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator)
64 { 64 {
65 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp lement<Navigator>::from(navigator, supplementName())); 65 NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(WillBeHeapSupp lement<Navigator>::from(navigator, supplementName()));
66 if (!supplement) { 66 if (!supplement) {
67 supplement = new NavigatorWebMIDI(navigator.frame()); 67 supplement = new NavigatorWebMIDI(navigator.frame());
68 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); 68 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
69 } 69 }
70 return *supplement; 70 return *supplement;
71 } 71 }
72 72
73 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi gator& navigator, const Dictionary& options) 73 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi gator& navigator, const MIDIOptions* options)
74 { 74 {
75 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti ons); 75 return NavigatorWebMIDI::from(navigator).requestMIDIAccess(scriptState, opti ons);
76 } 76 }
77 77
78 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons t Dictionary& options) 78 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons t MIDIOptions* options)
79 { 79 {
80 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { 80 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) {
81 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState); 81 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState);
82 ScriptPromise promise = resolver->promise(); 82 ScriptPromise promise = resolver->promise();
83 // FIXME: Currently this rejection does not work because the context is stopped. 83 // FIXME: Currently this rejection does not work because the context is stopped.
84 resolver->reject(DOMError::create("AbortError")); 84 resolver->reject(DOMError::create("AbortError"));
85 return promise; 85 return promise;
86 } 86 }
87 87
88 return MIDIAccessInitializer::start(scriptState, MIDIOptions(options)); 88 return MIDIAccessInitializer::start(scriptState, options);
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webmidi/NavigatorWebMIDI.h ('k') | Source/modules/webmidi/NavigatorWebMIDI.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698