OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ | |
6 #define CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ | |
7 | |
8 #if defined(_MSC_VER) | |
9 typedef unsigned char uint8_t; | |
10 typedef unsigned int uint32_t; | |
11 #else | |
12 #include <stdint.h> | |
13 #endif | |
14 | |
15 // Define CDM_API so that functionality implemented by the CDM module | |
16 // can be exported to consumers. | |
17 #if defined(WIN32) | |
18 | |
19 #if defined(CDM_IMPLEMENTATION) | |
20 #define CDM_API __declspec(dllexport) | |
21 #else | |
22 #define CDM_API __declspec(dllimport) | |
23 #endif // defined(CDM_IMPLEMENTATION) | |
24 | |
25 #else // defined(WIN32) | |
26 #define CDM_API __attribute__((visibility("default"))) | |
27 #endif // defined(WIN32) | |
28 | |
29 // Define CdmFilePathCharType to be the type of characters passed when | |
30 // specifying file paths to ProcessHostChallenge() | |
31 #if defined(WIN32) | |
32 // On Windows, for Unicode-aware applications, native pathnames are wchar_t | |
33 // arrays. | |
34 typedef std::wstring::value_type CdmFilePathCharType; | |
35 #else | |
36 // On other platforms, native pathnames are char arrays. | |
37 typedef std::string::value_type CdmFilePathCharType; | |
xhwang
2016/10/31 22:43:47
Can you use wchar_t and char directly? It's a bit
xhwang
2016/10/31 22:43:47
CdmFilePath is a bit misleading; some paths are no
jrummell
2016/11/02 20:10:03
Done.
jrummell
2016/11/02 20:10:03
Done.
| |
38 #endif // defined(OS_WIN) | |
xhwang
2016/10/31 22:43:47
s/OS_WIN/WIN32?
jrummell
2016/11/02 20:10:03
Done.
| |
39 | |
40 extern "C" { | |
41 // Returns the |response| to ProcessHostChallenge(). If the challenge fails, | |
42 // |response| = nullptr and |response_size| = 0. |context| must be the value | |
43 // passed in to ProcessHostChallenge(). | |
44 typedef void (*HostResponseFunc)(const uint8_t* response, | |
45 uint32_t response_size, | |
46 void* context); | |
47 | |
48 // This method receives the |challenge| from the CDM as well as a list of | |
49 // additional binary file paths created by the host and a callback function. | |
50 // |response_func| is called when the challenge has been processed, passing | |
51 // |context| along with the desired response data. | |
52 CDM_API void ProcessHostChallenge(const uint8_t* challenge, | |
53 uint32_t challenge_size, | |
54 const CdmFilePathCharType** binary_file_paths, | |
55 uint32_t num_binary_file_paths, | |
56 HostResponseFunc response_func, | |
57 void* context); | |
58 } | |
59 | |
60 #undef CDM_API | |
61 | |
62 #endif // CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ | |
OLD | NEW |