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 "modules/donottrack/NavigatorDoNotTrack.h" | 32 #include "core/platform/graphics/CDMChromium.h" |
| 33 | 33 |
| 34 #include "core/loader/FrameLoader.h" | 34 #include "core/platform/NotImplemented.h" |
| 35 #include "core/loader/FrameLoaderClient.h" | 35 #include "core/platform/graphics/CDMSessionChromium.h" |
| 36 #include "core/page/Frame.h" | 36 #include "public/platform/Platform.h" |
| 37 #include "core/page/Navigator.h" | 37 #include "wtf/text/WTFString.h" |
| 38 #include "wtf/PassOwnPtr.h" | |
| 39 | 38 |
| 40 namespace WebCore { | 39 namespace WebCore { |
| 41 | 40 |
| 42 NavigatorDoNotTrack::NavigatorDoNotTrack(Frame* frame) | 41 bool CDM::supportsKeySystem(const WTF::String& keySystem) |
| 43 : DOMWindowProperty(frame) | |
| 44 { | 42 { |
| 43 // FIXME: Chromium should handle this, possibly using | |
| 44 // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). | |
| 45 notImplemented(); | |
| 46 if (keySystem == "org.w3.clearkey") | |
| 47 return true; | |
| 48 | |
| 49 return false; | |
| 45 } | 50 } |
| 46 | 51 |
| 47 NavigatorDoNotTrack::~NavigatorDoNotTrack() | 52 // Factory method: Chromium-implementation |
| 53 PassOwnPtr<CDM> CDM::create(const WTF::String& keySystem) | |
|
abarth-chromium
2013/06/07 00:08:23
No need for the WTF:: prefix
ddorwin
2013/06/10 22:52:34
Done.
| |
| 48 { | 54 { |
| 55 ASSERT(!keySystem.isNull() && !keySystem.isEmpty()); | |
| 56 OwnPtr<WebKit::WebCDM> cdm = adoptPtr(WebKit::Platform::current()->createCDM (keySystem)); | |
| 57 if (!cdm) | |
| 58 return PassOwnPtr<CDM>(); | |
|
abarth-chromium
2013/06/07 00:08:23
You can just write:
return nullptr;
ddorwin
2013/06/10 22:52:34
Done.
| |
| 59 return adoptPtr(new CDMChromium(cdm.release())); | |
| 49 } | 60 } |
| 50 | 61 |
| 51 const char* NavigatorDoNotTrack::supplementName() | 62 CDMChromium::CDMChromium(PassOwnPtr<WebKit::WebCDM> cdm) |
| 63 : m_cdm(cdm) | |
| 52 { | 64 { |
| 53 return "NavigatorDoNotTrack"; | 65 ASSERT(m_cdm); |
| 54 } | 66 } |
| 55 | 67 |
| 56 NavigatorDoNotTrack* NavigatorDoNotTrack::from(Navigator* navigator) | 68 bool CDMChromium::supportsMIMEType(const WTF::String& mimeType) |
| 57 { | 69 { |
| 58 NavigatorDoNotTrack* supplement = static_cast<NavigatorDoNotTrack*>(Suppleme nt<Navigator>::from(navigator, supplementName())); | 70 // FIXME: Chromium should handle this, possibly using |
| 59 if (!supplement) { | 71 // MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(). |
| 60 supplement = new NavigatorDoNotTrack(navigator->frame()); | 72 notImplemented(); |
| 61 provideTo(navigator, supplementName(), adoptPtr(supplement)); | 73 return mimeType == "video/webm"; |
| 62 } | |
| 63 return supplement; | |
| 64 } | 74 } |
| 65 | 75 |
| 66 String NavigatorDoNotTrack::doNotTrack(Navigator* navigator) | 76 PassOwnPtr<CDMSession> CDMChromium::createSession(CDMSessionClient* client) |
| 67 { | 77 { |
| 68 return NavigatorDoNotTrack::from(navigator)->doNotTrack(); | 78 return adoptPtr(new CDMSessionChromium(*m_cdm, client)); |
| 69 } | |
| 70 | |
| 71 String NavigatorDoNotTrack::doNotTrack() | |
| 72 { | |
| 73 return frame() ? frame()->loader()->client()->doNotTrackValue() : String(); | |
| 74 } | 79 } |
| 75 | 80 |
| 76 } // namespace WebCore | 81 } // namespace WebCore |
| OLD | NEW |