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

Side by Side Diff: Source/core/platform/midi/MIDIAccessor.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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/platform/midi/MIDIAccessor.h" 32 #include "core/platform/midi/MIDIAccessor.h"
33 33
34 #include "core/platform/midi/MIDIAccessorClient.h" 34 #include "core/platform/midi/MIDIAccessorClient.h"
35 #include "public/platform/Platform.h" 35 #include "public/platform/Platform.h"
36 #include "public/platform/WebMIDIAccessor.h" 36 #include "public/platform/WebMIDIAccessor.h"
37 #include "public/web/WebSecurityOrigin.h"
38 #include "weborigin/SecurityOrigin.h"
37 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
38 40
41 using WebKit::WebSecurityOrigin;
39 using WebKit::WebString; 42 using WebKit::WebString;
40 43
41 namespace WebCore { 44 namespace WebCore {
42 45
43 // Factory method 46 // Factory method
44 PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) 47 PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client)
45 { 48 {
46 return adoptPtr(new MIDIAccessor(client)); 49 return adoptPtr(new MIDIAccessor(client));
47 } 50 }
48 51
(...skipping 10 matching lines...) Expand all
59 void MIDIAccessor::requestAccess(bool access) 62 void MIDIAccessor::requestAccess(bool access)
60 { 63 {
61 m_accessor->requestAccess(access); 64 m_accessor->requestAccess(access);
62 } 65 }
63 66
64 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s ize_t length, double timeStamp) 67 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, s ize_t length, double timeStamp)
65 { 68 {
66 m_accessor->sendMIDIData(portIndex, data, length, timeStamp); 69 m_accessor->sendMIDIData(portIndex, data, length, timeStamp);
67 } 70 }
68 71
72 WebSecurityOrigin MIDIAccessor::securityOrigin() const
73 {
74 return WebSecurityOrigin(m_client->securityOrigin());
75 }
76
69 void MIDIAccessor::didAddInputPort(const WebString& id, const WebString& manufac turer, const WebString& name, const WebString& version) 77 void MIDIAccessor::didAddInputPort(const WebString& id, const WebString& manufac turer, const WebString& name, const WebString& version)
70 { 78 {
71 m_client->didAddInputPort(id, manufacturer, name, version); 79 m_client->didAddInputPort(id, manufacturer, name, version);
72 } 80 }
73 81
74 void MIDIAccessor::didAddOutputPort(const WebString& id, const WebString& manufa cturer, const WebString& name, const WebString& version) 82 void MIDIAccessor::didAddOutputPort(const WebString& id, const WebString& manufa cturer, const WebString& name, const WebString& version)
75 { 83 {
76 m_client->didAddOutputPort(id, manufacturer, name, version); 84 m_client->didAddOutputPort(id, manufacturer, name, version);
77 } 85 }
78 86
79 void MIDIAccessor::didAllowAccess() 87 void MIDIAccessor::didAllowAccess()
80 { 88 {
81 m_client->didAllowAccess(); 89 m_client->didAllowAccess();
82 } 90 }
83 91
84 void MIDIAccessor::didBlockAccess() 92 void MIDIAccessor::didBlockAccess()
85 { 93 {
86 m_client->didBlockAccess(); 94 m_client->didBlockAccess();
87 } 95 }
88 96
89 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d ata, size_t length, double timeStamp) 97 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* d ata, size_t length, double timeStamp)
90 { 98 {
91 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); 99 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp);
92 } 100 }
93 101
94 } // namespace WebCore 102 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698