Chromium Code Reviews| Index: content_decryption_module_broker.h |
| diff --git a/content_decryption_module_broker.h b/content_decryption_module_broker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eddce28c5f953556403a5eb0821a6c345ca4ef87 |
| --- /dev/null |
| +++ b/content_decryption_module_broker.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ |
| +#define CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ |
| + |
| +#if defined(_MSC_VER) |
| +typedef unsigned char uint8_t; |
| +typedef unsigned int uint32_t; |
| +#else |
| +#include <stdint.h> |
| +#endif |
| + |
| +// Define CDM_API so that functionality implemented by the CDM module |
| +// can be exported to consumers. |
| +#if defined(WIN32) |
| + |
| +#if defined(CDM_IMPLEMENTATION) |
| +#define CDM_API __declspec(dllexport) |
| +#else |
| +#define CDM_API __declspec(dllimport) |
| +#endif // defined(CDM_IMPLEMENTATION) |
| + |
| +#else // defined(WIN32) |
| +#define CDM_API __attribute__((visibility("default"))) |
| +#endif // defined(WIN32) |
| + |
| +// Define CdmFilePathCharType to be the type of characters passed when |
| +// specifying file paths to ProcessHostChallenge() |
| +#if defined(WIN32) |
| +// On Windows, for Unicode-aware applications, native pathnames are wchar_t |
| +// arrays. |
| +typedef std::wstring::value_type CdmFilePathCharType; |
| +#else |
| +// On other platforms, native pathnames are char arrays. |
| +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.
|
| +#endif // defined(OS_WIN) |
|
xhwang
2016/10/31 22:43:47
s/OS_WIN/WIN32?
jrummell
2016/11/02 20:10:03
Done.
|
| + |
| +extern "C" { |
| +// Returns the |response| to ProcessHostChallenge(). If the challenge fails, |
| +// |response| = nullptr and |response_size| = 0. |context| must be the value |
| +// passed in to ProcessHostChallenge(). |
| +typedef void (*HostResponseFunc)(const uint8_t* response, |
| + uint32_t response_size, |
| + void* context); |
| + |
| +// This method receives the |challenge| from the CDM as well as a list of |
| +// additional binary file paths created by the host and a callback function. |
| +// |response_func| is called when the challenge has been processed, passing |
| +// |context| along with the desired response data. |
| +CDM_API void ProcessHostChallenge(const uint8_t* challenge, |
| + uint32_t challenge_size, |
| + const CdmFilePathCharType** binary_file_paths, |
| + uint32_t num_binary_file_paths, |
| + HostResponseFunc response_func, |
| + void* context); |
| +} |
| + |
| +#undef CDM_API |
| + |
| +#endif // CDM_CONTENT_DECRYPTION_MODULE_BROKER_H_ |