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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/midi/MIDIAccessorChromium.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/midi/MIDIAccessorChromium.cpp
diff --git a/Source/core/html/ime/InputMethodContext.cpp b/Source/core/platform/midi/MIDIAccessorChromium.cpp
similarity index 52%
copy from Source/core/html/ime/InputMethodContext.cpp
copy to Source/core/platform/midi/MIDIAccessorChromium.cpp
index 6723fbba788423b047956834c49e474ba01ca299..0f9e5b02f9d616a9552db537f333c758cf90151c 100644
--- a/Source/core/html/ime/InputMethodContext.cpp
+++ b/Source/core/platform/midi/MIDIAccessorChromium.cpp
@@ -29,74 +29,59 @@
*/
#include "config.h"
-#include "core/html/ime/InputMethodContext.h"
-#include "core/html/ime/Composition.h"
+#include "core/platform/midi/MIDIAccessorChromium.h"
-namespace WebCore {
+#include "public/platform/Platform.h"
+#include "wtf/text/WTFString.h"
-PassOwnPtr<InputMethodContext> InputMethodContext::create(HTMLElement* element)
-{
- return adoptPtr(new InputMethodContext(element));
-}
-
-InputMethodContext::InputMethodContext(HTMLElement* element)
- : m_enabled(false)
- , m_composition(0)
- , m_element(element)
-{
- ScriptWrappable::init(this);
-}
+using WebKit::WebString;
+
+namespace WebCore {
-InputMethodContext::~InputMethodContext()
+// Factory method: Chromium-implementation
+PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client)
{
+ return adoptPtr(new MIDIAccessorChromium(client));
}
-Composition* InputMethodContext::composition() const
+MIDIAccessorChromium::MIDIAccessorChromium(MIDIAccessorClient* client)
+ : m_client(client)
{
- // FIXME: Implement this. This should lazily update the composition object
- // here.
- return m_composition.get();
-}
+ ASSERT(client);
-bool InputMethodContext::enabled() const
-{
- // FIXME: Implement this. Enabled state may change between calls from user
- // action and the status should be retrieved here.
- return m_enabled;
+ m_accessor = adoptPtr(WebKit::Platform::current()->createMIDIAccessor(this));
+ ASSERT(m_accessor);
}
-void InputMethodContext::setEnabled(bool enabled)
+void MIDIAccessorChromium::requestAccess(int access)
{
- // FIXME: Implement this. The enabled state should propagate to IME.
- m_enabled = enabled;
+ m_accessor->requestAccess(access);
}
-String InputMethodContext::locale() const
+void MIDIAccessorChromium::addInputPort(const WebString& id, const WebString& manufacturer, const WebString& name, const WebString& version)
{
- // FIXME: Implement this.
- return emptyString();
+ m_client->addInputPort(id, manufacturer, name, version);
}
-void InputMethodContext::confirmComposition()
+void MIDIAccessorChromium::addOutputPort(const WebString& id, const WebString& manufacturer, const WebString& name, const WebString& version)
{
- // FIXME: Implement this.
+ m_client->addOutputPort(id, manufacturer, name, version);
}
-void InputMethodContext::setCaretRectangle(Node* anchor, int x, int y, int w, int h)
+void MIDIAccessorChromium::accessApproved(bool approved)
{
- // FIXME: Implement this.
+ m_client->accessApproved(approved);
}
-void InputMethodContext::setExclusionRectangle(Node* anchor, int x, int y, int w, int h)
+void MIDIAccessorChromium::sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
{
- // FIXME: Implement this.
+ m_accessor->sendMIDIData(portIndex, data, length, timeStamp);
}
-bool InputMethodContext::open()
+void MIDIAccessorChromium::receiveMIDIData(unsigned portIndex, const UInt8* data, size_t length, double timeStamp)
{
- // FIXME: Implement this.
- return false;
+ m_client->receiveMIDIData(portIndex, data, length, timeStamp);
}
} // namespace WebCore
« 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