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

Side by Side Diff: Source/core/platform/midi/MIDIAccessorChromium.cpp

Issue 16288002: Web MIDI API (work in progress) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add accessApproved() Created 7 years, 6 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/core/platform/midi/MIDIAccessorChromium.h ('k') | Source/modules/modules.gypi » ('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 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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/html/ime/InputMethodContext.h"
33 32
34 #include "core/html/ime/Composition.h" 33 #include "core/platform/midi/MIDIAccessorChromium.h"
35 34
35 #include "public/platform/Platform.h"
36 #include "wtf/text/WTFString.h"
37
38 using WebKit::WebString;
39
36 namespace WebCore { 40 namespace WebCore {
37 41
38 PassOwnPtr<InputMethodContext> InputMethodContext::create(HTMLElement* element) 42 // Factory method: Chromium-implementation
43 PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client)
39 { 44 {
40 return adoptPtr(new InputMethodContext(element)); 45 return adoptPtr(new MIDIAccessorChromium(client));
41 } 46 }
42 47
43 InputMethodContext::InputMethodContext(HTMLElement* element) 48 MIDIAccessorChromium::MIDIAccessorChromium(MIDIAccessorClient* client)
44 : m_enabled(false) 49 : m_client(client)
45 , m_composition(0)
46 , m_element(element)
47 { 50 {
48 ScriptWrappable::init(this); 51 ASSERT(client);
52
53 m_accessor = adoptPtr(WebKit::Platform::current()->createMIDIAccessor(this)) ;
54 ASSERT(m_accessor);
49 } 55 }
50 56
51 InputMethodContext::~InputMethodContext() 57 void MIDIAccessorChromium::requestAccess(int access)
52 { 58 {
59 m_accessor->requestAccess(access);
53 } 60 }
54 61
55 Composition* InputMethodContext::composition() const 62 void MIDIAccessorChromium::addInputPort(const WebString& id, const WebString& ma nufacturer, const WebString& name, const WebString& version)
56 { 63 {
57 // FIXME: Implement this. This should lazily update the composition object 64 m_client->addInputPort(id, manufacturer, name, version);
58 // here.
59 return m_composition.get();
60 } 65 }
61 66
62 bool InputMethodContext::enabled() const 67 void MIDIAccessorChromium::addOutputPort(const WebString& id, const WebString& m anufacturer, const WebString& name, const WebString& version)
63 { 68 {
64 // FIXME: Implement this. Enabled state may change between calls from user 69 m_client->addOutputPort(id, manufacturer, name, version);
65 // action and the status should be retrieved here.
66 return m_enabled;
67 } 70 }
68 71
69 void InputMethodContext::setEnabled(bool enabled) 72 void MIDIAccessorChromium::accessApproved(bool approved)
70 { 73 {
71 // FIXME: Implement this. The enabled state should propagate to IME. 74 m_client->accessApproved(approved);
72 m_enabled = enabled;
73 } 75 }
74 76
75 String InputMethodContext::locale() const 77 void MIDIAccessorChromium::sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
76 { 78 {
77 // FIXME: Implement this. 79 m_accessor->sendMIDIData(portIndex, data, length, timeStamp);
78 return emptyString();
79 } 80 }
80 81
81 void InputMethodContext::confirmComposition() 82 void MIDIAccessorChromium::receiveMIDIData(unsigned portIndex, const UInt8* data , size_t length, double timeStamp)
82 { 83 {
83 // FIXME: Implement this. 84 m_client->receiveMIDIData(portIndex, data, length, timeStamp);
84 }
85
86 void InputMethodContext::setCaretRectangle(Node* anchor, int x, int y, int w, in t h)
87 {
88 // FIXME: Implement this.
89 }
90
91 void InputMethodContext::setExclusionRectangle(Node* anchor, int x, int y, int w , int h)
92 {
93 // FIXME: Implement this.
94 }
95
96 bool InputMethodContext::open()
97 {
98 // FIXME: Implement this.
99 return false;
100 } 85 }
101 86
102 } // namespace WebCore 87 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/midi/MIDIAccessorChromium.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698