Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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" | 32 #include "core/platform/graphics/ContentDecryptionModule.h" |
| 33 | 33 |
| 34 #include "core/html/ime/Composition.h" | 34 #include "core/platform/NotImplemented.h" |
| 35 #include "core/platform/graphics/ContentDecryptionModuleSession.h" | |
| 36 #include "public/platform/Platform.h" | |
| 35 | 37 |
| 36 namespace WebCore { | 38 namespace WebCore { |
| 37 | 39 |
| 38 PassOwnPtr<InputMethodContext> InputMethodContext::create(HTMLElement* element) | 40 bool ContentDecryptionModule::supportsKeySystem(const String& keySystem) |
| 39 { | 41 { |
| 40 return adoptPtr(new InputMethodContext(element)); | 42 // FIXME: Chromium should handle this, possibly using |
| 43 // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). | |
| 44 notImplemented(); | |
| 45 if (keySystem == "org.w3.clearkey") | |
| 46 return true; | |
| 47 | |
| 48 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.
| |
| 41 } | 49 } |
| 42 | 50 |
| 43 InputMethodContext::InputMethodContext(HTMLElement* element) | 51 // 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.
| |
| 44 : m_enabled(false) | 52 PassOwnPtr<ContentDecryptionModule> ContentDecryptionModule::create(const String & keySystem) |
| 45 , m_composition(0) | |
| 46 , m_element(element) | |
| 47 { | 53 { |
| 48 ScriptWrappable::init(this); | 54 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.
| |
| 55 OwnPtr<WebKit::WebContentDecryptionModule> cdm = adoptPtr(WebKit::Platform:: current()->createContentDecryptionModule(keySystem)); | |
| 56 if (!cdm) | |
| 57 return nullptr; | |
| 58 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.
| |
| 49 } | 59 } |
| 50 | 60 |
| 51 InputMethodContext::~InputMethodContext() | 61 ContentDecryptionModule::ContentDecryptionModule(PassOwnPtr<WebKit::WebContentDe cryptionModule> cdm) |
| 62 : m_cdm(cdm) | |
| 63 { | |
| 64 ASSERT(m_cdm); | |
| 65 } | |
| 66 | |
| 67 ContentDecryptionModule::~ContentDecryptionModule() | |
| 52 { | 68 { |
| 53 } | 69 } |
| 54 | 70 |
| 55 Composition* InputMethodContext::composition() const | 71 bool ContentDecryptionModule::supportsMIMEType(const String& mimeType) |
| 56 { | 72 { |
| 57 // FIXME: Implement this. This should lazily update the composition object | 73 // FIXME: Chromium should handle this, possibly using |
| 58 // here. | 74 // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). |
| 59 return m_composition.get(); | 75 notImplemented(); |
| 76 return mimeType == "video/webm"; | |
| 60 } | 77 } |
| 61 | 78 |
| 62 bool InputMethodContext::enabled() const | 79 PassOwnPtr<ContentDecryptionModuleSession> ContentDecryptionModule::createSessio n(ContentDecryptionModuleSessionClient* client) |
| 63 { | 80 { |
| 64 // FIXME: Implement this. Enabled state may change between calls from user | 81 return adoptPtr(new ContentDecryptionModuleSession(*m_cdm, client)); |
| 65 // action and the status should be retrieved here. | |
| 66 return m_enabled; | |
| 67 } | |
| 68 | |
| 69 void InputMethodContext::setEnabled(bool enabled) | |
| 70 { | |
| 71 // FIXME: Implement this. The enabled state should propagate to IME. | |
| 72 m_enabled = enabled; | |
| 73 } | |
| 74 | |
| 75 String InputMethodContext::locale() const | |
| 76 { | |
| 77 // FIXME: Implement this. | |
| 78 return emptyString(); | |
| 79 } | |
| 80 | |
| 81 void InputMethodContext::confirmComposition() | |
| 82 { | |
| 83 // FIXME: Implement this. | |
| 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 } | 82 } |
| 101 | 83 |
| 102 } // namespace WebCore | 84 } // namespace WebCore |
| OLD | NEW |