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_CDM_RESULT_PROMISE_H_ | |
6 #define CONTENT_RENDERER_MEDIA_CDM_RESULT_PROMISE_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 CdmResultPromise : public media::CdmPromiseTemplate<T> { | |
23 public: | |
24 CdmResultPromise(blink::WebContentDecryptionModuleResult result); | |
xhwang
2014/09/25 05:11:47
explicit
jrummell
2014/09/25 20:33:25
Done.
| |
25 CdmResultPromise(blink::WebContentDecryptionModuleResult result, | |
xhwang
2014/09/25 05:11:47
Pass the |result| by const-ref? I remember we had
jrummell
2014/09/25 20:33:25
Done.
| |
26 const std::string& uma_name); | |
xhwang
2014/09/25 05:11:46
Need a documentation about the uma_name version.
jrummell
2014/09/25 20:33:25
Done.
| |
27 | |
xhwang
2014/09/25 05:11:46
Here and in CdmPromiseTemplate, we should declare
jrummell
2014/09/25 20:33:25
Done. Will update CdmPromiseTemplate in a future C
| |
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); | |
xhwang
2014/09/25 05:11:46
We need some documentation here why we choose virt
jrummell
2014/09/25 20:33:24
Done.
| |
33 | |
34 blink::WebContentDecryptionModuleResult webCDMResult_; | |
xhwang
2014/09/25 05:11:46
use chromium style: web_cdm_result_;
jrummell
2014/09/25 20:33:25
Done.
| |
35 | |
36 private: | |
37 DISALLOW_COPY_AND_ASSIGN(CdmResultPromise); | |
38 }; | |
39 | |
40 // Specialization for no parameter to resolve(). | |
41 template <> | |
42 class CdmResultPromise<void> : public media::CdmPromiseTemplate<void> { | |
43 public: | |
44 CdmResultPromise(blink::WebContentDecryptionModuleResult result); | |
45 CdmResultPromise(blink::WebContentDecryptionModuleResult result, | |
46 const std::string& uma_name); | |
47 | |
48 protected: | |
49 virtual void OnResolve(); | |
50 void OnReject(media::MediaKeys::Exception exception_code, | |
51 uint32 system_code, | |
52 const std::string& error_message); | |
53 | |
54 blink::WebContentDecryptionModuleResult webCDMResult_; | |
55 | |
56 private: | |
57 DISALLOW_COPY_AND_ASSIGN(CdmResultPromise); | |
58 }; | |
59 | |
60 typedef CdmResultPromise<void> SimpleCdmResultPromise; | |
61 typedef CdmResultPromise<media::KeyIdsVector> KeyIdsCdmResultPromise; | |
ddorwin
2014/09/25 00:07:16
Can we define this where it's used? This file prob
ddorwin
2014/09/25 00:16:38
We could move this, but we can't move the others.
jrummell
2014/09/25 20:33:25
Done.
| |
62 | |
63 } // namespace content | |
64 | |
65 #endif // CONTENT_RENDERER_MEDIA_CDM_RESULT_PROMISE_H_ | |
OLD | NEW |