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

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

Issue 18325007: Web MIDI: introduce WebMIDIClient API to request a permission (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: client api Created 7 years, 5 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 | Annotate | Revision Log
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 MIDIAccess::MIDIAccess(ScriptExecutionContext* context, MIDIAccessPromise* promi se) 59 MIDIAccess::MIDIAccess(ScriptExecutionContext* context, MIDIAccessPromise* promi se)
60 : ActiveDOMObject(context) 60 : ActiveDOMObject(context)
61 , m_promise(promise) 61 , m_promise(promise)
62 , m_hasAccess(false) 62 , m_hasAccess(false)
63 { 63 {
64 ScriptWrappable::init(this); 64 ScriptWrappable::init(this);
65 m_accessor = MIDIAccessor::create(this); 65 m_accessor = MIDIAccessor::create(this);
66 m_accessor->requestAccess(promise->options()->sysex); 66 m_accessor->requestAccess(promise->options()->sysex);
67 } 67 }
68 68
69 SecurityOrigin* MIDIAccess::securityOrigin() const
70 {
71 return scriptExecutionContext()->securityOrigin();
72 }
73
69 void MIDIAccess::didAddInputPort(const String& id, const String& manufacturer, c onst String& name, const String& version) 74 void MIDIAccess::didAddInputPort(const String& id, const String& manufacturer, c onst String& name, const String& version)
70 { 75 {
71 ASSERT(isMainThread()); 76 ASSERT(isMainThread());
72 77
73 m_inputs.append(MIDIInput::create(scriptExecutionContext(), id, manufacturer , name, version)); 78 m_inputs.append(MIDIInput::create(scriptExecutionContext(), id, manufacturer , name, version));
74 } 79 }
75 80
76 void MIDIAccess::didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version) 81 void MIDIAccess::didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version)
77 { 82 {
78 ASSERT(isMainThread()); 83 ASSERT(isMainThread());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 m_inputs[portIndex]->didReceiveMIDIData(portIndex, data, length, timeSta mpInMilliseconds); 118 m_inputs[portIndex]->didReceiveMIDIData(portIndex, data, length, timeSta mpInMilliseconds);
114 } 119 }
115 } 120 }
116 121
117 void MIDIAccess::stop() 122 void MIDIAccess::stop()
118 { 123 {
119 m_hasAccess = false; 124 m_hasAccess = false;
120 } 125 }
121 126
122 } // namespace WebCore 127 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698