Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "media/base/cdm_promise.h" | |
| 12 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 // Used to convert a WebContentDecryptionModuleResult into a CdmPromise so that | |
| 17 // it can be passed through Chromium. When CdmPromise::resolve(T) is called, | |
| 18 // OnResolve(T) will be called and will call the appropriate complete...() | |
| 19 // method on WebContentDecryptionModuleResult. If CdmPromise::reject() is called | |
| 20 // instead, WebContentDecryptionModuleResult::completeWithError() is called. | |
| 21 template <typename T> | |
| 22 class WebCdmPromiseTemplate : public media::CdmPromiseTemplate<T> { | |
|
ddorwin
2014/09/24 17:37:47
While thinking about how to name this file, I real
jrummell
2014/09/24 22:32:32
CdmResultPromise it is.
| |
| 23 public: | |
| 24 WebCdmPromiseTemplate(blink::WebContentDecryptionModuleResult result); | |
| 25 WebCdmPromiseTemplate(blink::WebContentDecryptionModuleResult result, | |
| 26 const std::string& uma_name); | |
| 27 | |
| 28 protected: | |
| 29 virtual void OnResolve(const T& result); | |
| 30 void OnReject(media::MediaKeys::Exception exception_code, | |
| 31 uint32 system_code, | |
| 32 const std::string& error_message); | |
| 33 | |
| 34 blink::WebContentDecryptionModuleResult webCDMResult_; | |
| 35 | |
| 36 DISALLOW_COPY_AND_ASSIGN(WebCdmPromiseTemplate); | |
| 37 }; | |
| 38 | |
| 39 // Specialization for no parameter to resolve(). | |
| 40 template <> | |
| 41 class WebCdmPromiseTemplate<void> : public media::CdmPromiseTemplate<void> { | |
| 42 public: | |
| 43 WebCdmPromiseTemplate(blink::WebContentDecryptionModuleResult result); | |
| 44 WebCdmPromiseTemplate(blink::WebContentDecryptionModuleResult result, | |
| 45 const std::string& uma_name); | |
| 46 | |
| 47 protected: | |
| 48 virtual void OnResolve(); | |
| 49 void OnReject(media::MediaKeys::Exception exception_code, | |
| 50 uint32 system_code, | |
| 51 const std::string& error_message); | |
| 52 | |
| 53 blink::WebContentDecryptionModuleResult webCDMResult_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(WebCdmPromiseTemplate); | |
| 56 }; | |
| 57 | |
| 58 typedef WebCdmPromiseTemplate<void> WebSimpleCdmPromise; | |
| 59 typedef WebCdmPromiseTemplate<media::KeyIdsVector> WebKeyIdsPromise; | |
| 60 | |
| 61 } // namespace content | |
| 62 | |
| 63 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ | |
| OLD | NEW |