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

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

Issue 18325007: Web MIDI: introduce WebMIDIClient API to request a permission (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address chris' review 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
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/webmidi/MIDIAccess.cpp » ('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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 MIDIInputVector inputs() const { return m_inputs; } 55 MIDIInputVector inputs() const { return m_inputs; }
56 MIDIOutputVector outputs() const { return m_outputs; } 56 MIDIOutputVector outputs() const { return m_outputs; }
57 57
58 using RefCounted<MIDIAccess>::ref; 58 using RefCounted<MIDIAccess>::ref;
59 using RefCounted<MIDIAccess>::deref; 59 using RefCounted<MIDIAccess>::deref;
60 60
61 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect);
62 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
63 63
64 void enableSysEx(bool enable);
65
64 // EventTarget 66 // EventTarget
65 virtual const AtomicString& interfaceName() const OVERRIDE { return eventNam es().interfaceForMIDIAccess; } 67 virtual const AtomicString& interfaceName() const OVERRIDE { return eventNam es().interfaceForMIDIAccess; }
66 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { re turn ActiveDOMObject::scriptExecutionContext(); } 68 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { re turn ActiveDOMObject::scriptExecutionContext(); }
67 69
68 // ActiveDOMObject 70 // ActiveDOMObject
69 virtual bool canSuspend() const OVERRIDE { return true; } 71 virtual bool canSuspend() const OVERRIDE { return true; }
70 virtual void stop(); 72 virtual void stop();
71 73
72 // MIDIAccessorClient 74 // MIDIAccessorClient
73 virtual void didAddInputPort(const String& id, const String& manufacturer, c onst String& name, const String& version) OVERRIDE; 75 virtual void didAddInputPort(const String& id, const String& manufacturer, c onst String& name, const String& version) OVERRIDE;
74 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version) OVERRIDE; 76 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version) OVERRIDE;
75 virtual void didAllowAccess() OVERRIDE; 77 virtual void didStartSession() OVERRIDE;
76 virtual void didBlockAccess() OVERRIDE;
77 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) OVERRIDE; 78 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) OVERRIDE;
78 79
79 private: 80 private:
80 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*); 81 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*);
81 82
83 void startRequest();
84 virtual void permissionDenied();
85
82 // EventTarget 86 // EventTarget
83 virtual void refEventTarget() OVERRIDE { ref(); } 87 virtual void refEventTarget() OVERRIDE { ref(); }
84 virtual void derefEventTarget() OVERRIDE { deref(); } 88 virtual void derefEventTarget() OVERRIDE { deref(); }
85 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD ata; } 89 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD ata; }
86 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT argetData; } 90 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT argetData; }
87 91
88 MIDIInputVector m_inputs; 92 MIDIInputVector m_inputs;
89 MIDIOutputVector m_outputs; 93 MIDIOutputVector m_outputs;
90 EventTargetData m_eventTargetData; 94 EventTargetData m_eventTargetData;
91 MIDIAccessPromise* m_promise; 95 MIDIAccessPromise* m_promise;
92 96
93 OwnPtr<MIDIAccessor> m_accessor; 97 OwnPtr<MIDIAccessor> m_accessor;
94 bool m_hasAccess; 98 bool m_hasAccess;
99 bool m_enableSysEx;
100 bool m_requesting;
95 }; 101 };
96 102
97 } // namespace WebCore 103 } // namespace WebCore
98 104
99 #endif // MIDIAccess_h 105 #endif // MIDIAccess_h
OLDNEW
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/webmidi/MIDIAccess.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698