Index: Source/core/platform/graphics/ContentDecryptionModule.cpp |
diff --git a/Source/core/html/ime/InputMethodContext.cpp b/Source/core/platform/graphics/ContentDecryptionModule.cpp |
similarity index 51% |
copy from Source/core/html/ime/InputMethodContext.cpp |
copy to Source/core/platform/graphics/ContentDecryptionModule.cpp |
index 6723fbba788423b047956834c49e474ba01ca299..be34049b7478fa15975281ab26210345a419df7a 100644 |
--- a/Source/core/html/ime/InputMethodContext.cpp |
+++ b/Source/core/platform/graphics/ContentDecryptionModule.cpp |
@@ -29,74 +29,56 @@ |
*/ |
#include "config.h" |
-#include "core/html/ime/InputMethodContext.h" |
+#include "core/platform/graphics/ContentDecryptionModule.h" |
-#include "core/html/ime/Composition.h" |
+#include "core/platform/NotImplemented.h" |
+#include "core/platform/graphics/ContentDecryptionModuleSession.h" |
+#include "public/platform/Platform.h" |
namespace WebCore { |
-PassOwnPtr<InputMethodContext> InputMethodContext::create(HTMLElement* element) |
+bool ContentDecryptionModule::supportsKeySystem(const String& keySystem) |
{ |
- return adoptPtr(new InputMethodContext(element)); |
-} |
- |
-InputMethodContext::InputMethodContext(HTMLElement* element) |
- : m_enabled(false) |
- , m_composition(0) |
- , m_element(element) |
-{ |
- ScriptWrappable::init(this); |
-} |
- |
-InputMethodContext::~InputMethodContext() |
-{ |
-} |
- |
-Composition* InputMethodContext::composition() const |
-{ |
- // FIXME: Implement this. This should lazily update the composition object |
- // here. |
- return m_composition.get(); |
-} |
- |
-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; |
-} |
+ // FIXME: Chromium should handle this, possibly using |
+ // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). |
+ notImplemented(); |
+ if (keySystem == "org.w3.clearkey") |
+ return true; |
-void InputMethodContext::setEnabled(bool enabled) |
-{ |
- // FIXME: Implement this. The enabled state should propagate to IME. |
- m_enabled = enabled; |
+ return false; |
abarth-chromium
2013/06/12 23:03:51
You can just write:
return keySystem == "org.w3.c
ddorwin
2013/06/12 23:55:54
Done.
|
} |
-String InputMethodContext::locale() const |
+// Factory method: Chromium-implementation |
abarth-chromium
2013/06/12 23:03:51
No need for this comment.
ddorwin
2013/06/12 23:55:54
Done.
|
+PassOwnPtr<ContentDecryptionModule> ContentDecryptionModule::create(const String& keySystem) |
{ |
- // FIXME: Implement this. |
- return emptyString(); |
+ ASSERT(!keySystem.isNull() && !keySystem.isEmpty()); |
abarth-chromium
2013/06/12 23:03:51
isEmpty is a superset of isNull. You can just writ
ddorwin
2013/06/12 23:55:54
Done here and in MediaKeys.cpp.
|
+ OwnPtr<WebKit::WebContentDecryptionModule> cdm = adoptPtr(WebKit::Platform::current()->createContentDecryptionModule(keySystem)); |
+ if (!cdm) |
+ return nullptr; |
+ return adoptPtr(new ContentDecryptionModule(cdm.release())); |
abarth-chromium
2013/06/12 23:03:51
No need to call adoptPtr here. You've already ado
abarth-chromium
2013/06/12 23:26:38
Oops, sorry. I misread the code. You're right.
|
} |
-void InputMethodContext::confirmComposition() |
+ContentDecryptionModule::ContentDecryptionModule(PassOwnPtr<WebKit::WebContentDecryptionModule> cdm) |
+ : m_cdm(cdm) |
{ |
- // FIXME: Implement this. |
+ ASSERT(m_cdm); |
} |
-void InputMethodContext::setCaretRectangle(Node* anchor, int x, int y, int w, int h) |
+ContentDecryptionModule::~ContentDecryptionModule() |
{ |
- // FIXME: Implement this. |
} |
-void InputMethodContext::setExclusionRectangle(Node* anchor, int x, int y, int w, int h) |
+bool ContentDecryptionModule::supportsMIMEType(const String& mimeType) |
{ |
- // FIXME: Implement this. |
+ // FIXME: Chromium should handle this, possibly using |
+ // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). |
+ notImplemented(); |
+ return mimeType == "video/webm"; |
} |
-bool InputMethodContext::open() |
+PassOwnPtr<ContentDecryptionModuleSession> ContentDecryptionModule::createSession(ContentDecryptionModuleSessionClient* client) |
{ |
- // FIXME: Implement this. |
- return false; |
+ return adoptPtr(new ContentDecryptionModuleSession(*m_cdm, client)); |
} |
} // namespace WebCore |