summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 06:12:07 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 06:12:07 +0000
commit8953fe29389bd52e4a42b580330db0db86fa997f (patch)
tree7d9a5b640f2e19fa1f4bd62ef92fcf0594074c62 /webkit
parent7c6de19bed86fde0c8eb83c73e40a972ad54b837 (diff)
downloadchromium_src-8953fe29389bd52e4a42b580330db0db86fa997f.zip
chromium_src-8953fe29389bd52e4a42b580330db0db86fa997f.tar.gz
chromium_src-8953fe29389bd52e4a42b580330db0db86fa997f.tar.bz2
Connect PpapiDecryptor and PluginInstance.
- In PpapiDecrytor, enable calls into the PluginInstance. - In PluginInstance, passing in all data needed by the PPP_ContentDecryptor interface. - Hook up DecryptorClient and PPB_ContentDecryptor calls in PluginInstance. BUG=138139 TEST=none Review URL: https://chromiumcodereview.appspot.com/10871006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/media/crypto/ppapi_decryptor.cc79
-rw-r--r--webkit/media/crypto/ppapi_decryptor.h14
-rw-r--r--webkit/plugins/ppapi/DEPS1
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc215
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h28
5 files changed, 276 insertions, 61 deletions
diff --git a/webkit/media/crypto/ppapi_decryptor.cc b/webkit/media/crypto/ppapi_decryptor.cc
index f547f68..70c4b1b 100644
--- a/webkit/media/crypto/ppapi_decryptor.cc
+++ b/webkit/media/crypto/ppapi_decryptor.cc
@@ -4,7 +4,13 @@
#include "webkit/media/crypto/ppapi_decryptor.h"
+#include <string>
+
+#include "base/bind.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "media/base/decoder_buffer.h"
#include "media/base/decryptor_client.h"
#include "webkit/media/crypto/key_systems.h"
@@ -16,7 +22,11 @@ PpapiDecryptor::PpapiDecryptor(
media::DecryptorClient* client,
const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance)
: client_(client),
- cdm_plugin_(plugin_instance) {
+ cdm_plugin_(plugin_instance),
+ render_loop_proxy_(base::MessageLoopProxy::current()) {
+ DCHECK(client_);
+ DCHECK(cdm_plugin_);
+ cdm_plugin_->set_decrypt_client(client);
}
PpapiDecryptor::~PpapiDecryptor() {
@@ -25,12 +35,18 @@ PpapiDecryptor::~PpapiDecryptor() {
void PpapiDecryptor::GenerateKeyRequest(const std::string& key_system,
const uint8* init_data,
int init_data_length) {
+ DVLOG(1) << "GenerateKeyRequest()";
+ DCHECK(render_loop_proxy_->BelongsToCurrentThread());
DCHECK(cdm_plugin_);
- // TODO(xhwang): Enable the following once we have updated PluginInstance.
- // if (!cdm_plugin_->GenerateKeyRequest(key_system,
- // init_data, init_data_length)) {
- // client_->KeyError(key_system, "", media::Decryptor::kUnknownError, 0);
- // }
+
+ // TODO(xhwang): Finalize the data type for |init_data| to avoid unnecessary
+ // data type conversions.
+ if (!cdm_plugin_->GenerateKeyRequest(
+ key_system,
+ std::string(reinterpret_cast<const char*>(init_data),
+ init_data_length))) {
+ ReportFailureToCallPlugin(key_system, "");
+ }
}
void PpapiDecryptor::AddKey(const std::string& key_system,
@@ -39,43 +55,52 @@ void PpapiDecryptor::AddKey(const std::string& key_system,
const uint8* init_data,
int init_data_length,
const std::string& session_id) {
+ DVLOG(1) << "AddKey()";
+ DCHECK(render_loop_proxy_->BelongsToCurrentThread());
DCHECK(cdm_plugin_);
- // TODO(xhwang): Enable the following once we have updated PluginInstance.
- // if (!cdm_plugin_->AddKey(key_system, key, key_length,
- // init_data, init_data_length, session_id)) {
- // client_->KeyError(key_system, session_id, Decryptor::kUnknownError, 0);
- // }
+
+ if (!cdm_plugin_->AddKey(session_id,
+ std::string(reinterpret_cast<const char*>(key),
+ key_length),
+ std::string(reinterpret_cast<const char*>(init_data),
+ init_data_length))) {
+ ReportFailureToCallPlugin(key_system, session_id);
+ }
}
void PpapiDecryptor::CancelKeyRequest(const std::string& key_system,
const std::string& session_id) {
+ DVLOG(1) << "CancelKeyRequest()";
+ DCHECK(render_loop_proxy_->BelongsToCurrentThread());
DCHECK(cdm_plugin_);
- // TODO(xhwang): Enable the following once we have updated PluginInstance.
- // if (!cdm_plugin_->CancelKeyRequest(key_system, session_id))
- // client_->KeyError(key_system, session_id, Decryptor::kUnknownError, 0);
+
+ if (!cdm_plugin_->CancelKeyRequest(session_id))
+ ReportFailureToCallPlugin(key_system, session_id);
}
void PpapiDecryptor::Decrypt(
const scoped_refptr<media::DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) {
- DCHECK(cdm_plugin_);
- // TODO(xhwang): Enable the following once we have updated PluginInstance.
- // TODO(xhwang): Need to figure out thread safety about PPP calls.
- // if (!cdm_plugin_->Decrypt(
- // encrypted, base::Bind(&PpapiDecryptor::DataReady, this, decrypt_cb))) {
- // decrypt_cb.Run(kError, NULL);
- // }
+ DVLOG(1) << "Decrypt()";
+ if (!render_loop_proxy_->BelongsToCurrentThread()) {
+ render_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&PpapiDecryptor::Decrypt, base::Unretained(this),
+ encrypted, decrypt_cb));
+ return;
+ }
+
+ if (!cdm_plugin_->Decrypt(encrypted, decrypt_cb))
+ decrypt_cb.Run(kError, NULL);
}
void PpapiDecryptor::Stop() {
}
-void PpapiDecryptor::DataReady(const DecryptCB& decrypt_cb,
- const uint8* data, int data_size ) {
- DCHECK(!decrypt_cb.is_null());
- scoped_refptr<media::DecoderBuffer> decrypted_data =
- media::DecoderBuffer::CopyFrom(data, data_size);
- decrypt_cb.Run(kSuccess, decrypted_data);
+void PpapiDecryptor::ReportFailureToCallPlugin(const std::string& key_system,
+ const std::string& session_id) {
+ DVLOG(1) << "Failed to call plugin.";
+ client_->KeyError(key_system, session_id, kUnknownError, 0);
}
} // namespace webkit_media
diff --git a/webkit/media/crypto/ppapi_decryptor.h b/webkit/media/crypto/ppapi_decryptor.h
index c779b17..841bb30 100644
--- a/webkit/media/crypto/ppapi_decryptor.h
+++ b/webkit/media/crypto/ppapi_decryptor.h
@@ -10,6 +10,10 @@
#include "base/memory/ref_counted.h"
#include "media/base/decryptor.h"
+namespace base {
+class MessageLoopProxy;
+}
+
namespace media {
class DecryptorClient;
}
@@ -22,6 +26,9 @@ class PluginInstance;
namespace webkit_media {
+// PpapiDecrypor implements media::Decryptor and forwards all calls to the
+// PluginInstance.
+// This class should always be created on the main renderer thread.
class PpapiDecryptor : public media::Decryptor {
public:
PpapiDecryptor(
@@ -46,13 +53,12 @@ class PpapiDecryptor : public media::Decryptor {
virtual void Stop() OVERRIDE;
private:
- // Callback for the plugin to hand back the decrypted data.
- void DataReady(const DecryptCB& decrypt_cb, const uint8* data, int data_size);
+ void ReportFailureToCallPlugin(const std::string& key_system,
+ const std::string& session_id);
- // TODO(xhwang): Need to figure out how the CDM plugin fires key events
- // (e.g. KeyMessage).
media::DecryptorClient* client_;
scoped_refptr<webkit::ppapi::PluginInstance> cdm_plugin_;
+ scoped_refptr<base::MessageLoopProxy> render_loop_proxy_;
DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor);
};
diff --git a/webkit/plugins/ppapi/DEPS b/webkit/plugins/ppapi/DEPS
index abdb8bd..0b8e33d 100644
--- a/webkit/plugins/ppapi/DEPS
+++ b/webkit/plugins/ppapi/DEPS
@@ -4,6 +4,7 @@ include_rules = [
"+ppapi/thunk",
"+printing",
"+media/audio",
+ "+media/base",
"+media/video",
"+ui/base/ime",
"+ui/base/range",
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 3656926..66940e8 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -9,10 +9,13 @@
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
#include "base/message_loop.h"
+#include "base/stl_util.h"
#include "base/stringprintf.h"
#include "base/time.h"
#include "base/utf_offset_string_conversions.h"
#include "base/utf_string_conversions.h"
+#include "media/base/decoder_buffer.h"
+#include "media/base/decryptor_client.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
#include "ppapi/c/dev/ppp_find_dev.h"
@@ -302,11 +305,11 @@ scoped_array<const char*> StringVectorToArgArray(
// of 0 on failure. Upon success, the returned Buffer resource has a reference
// count of 1.
PP_Resource MakeBufferResource(PP_Instance instance,
- const base::StringPiece& data) {
- if (data.empty())
+ const uint8* data, int size) {
+ if (!data || !size)
return 0;
- ScopedPPResource resource(PPB_Buffer_Impl::Create(instance, data.size()));
+ ScopedPPResource resource(PPB_Buffer_Impl::Create(instance, size));
if (!resource.get())
return 0;
@@ -315,11 +318,66 @@ PP_Resource MakeBufferResource(PP_Instance instance,
return 0;
BufferAutoMapper mapper(enter.object());
- memcpy(mapper.data(), data.data(), data.size());
+ if (!mapper.data() || mapper.size() < static_cast<size_t>(size))
+ return 0;
+ memcpy(mapper.data(), data, size);
return resource.get();
}
+// Copies the content of |str| into |array|.
+// Returns true if copy succeeded. Returns false if copy failed, e.g. if the
+// |array_size| is smaller than the |str| length.
+template <uint32_t array_size>
+bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
+ if (array_size < str.size())
+ return false;
+
+ memcpy(array, str.data(), str.size());
+ return true;
+}
+
+// Fills the |block_info| with information from |decrypt_config|, |timestamp|
+// and |request_id|.
+// Returns true if |block_info| is successfully filled. Returns false otherwise.
+bool MakeEncryptedBlockInfo(
+ const media::DecryptConfig& decrypt_config,
+ int64_t timestamp,
+ uint32_t request_id,
+ PP_EncryptedBlockInfo* block_info) {
+ DCHECK(block_info);
+
+ // TODO(xhwang): Fix initialization of PP_EncryptedBlockInfo here and
+ // anywhere else.
+ memset(block_info, 0, sizeof(*block_info));
+
+ block_info->tracking_info.request_id = request_id;
+ block_info->tracking_info.timestamp = timestamp;
+ block_info->data_offset = decrypt_config.data_offset();
+
+ if (!CopyStringToArray(decrypt_config.key_id(), block_info->key_id) ||
+ !CopyStringToArray(decrypt_config.iv(), block_info->iv) ||
+ !CopyStringToArray(decrypt_config.checksum(), block_info->checksum))
+ return false;
+
+ block_info->key_id_size = decrypt_config.key_id().size();
+ block_info->iv_size = decrypt_config.iv().size();
+ block_info->checksum_size = decrypt_config.checksum().size();
+
+ if (decrypt_config.subsamples().size() > arraysize(block_info->subsamples))
+ return false;
+
+ block_info->num_subsamples = decrypt_config.subsamples().size();
+ for (uint32_t i = 0; i < block_info->num_subsamples; ++i) {
+ block_info->subsamples[i].clear_bytes =
+ decrypt_config.subsamples()[i].clear_bytes;
+ block_info->subsamples[i].cipher_bytes =
+ decrypt_config.subsamples()[i].cypher_bytes;
+ }
+
+ return true;
+}
+
} // namespace
// static
@@ -389,7 +447,9 @@ PluginInstance::PluginInstance(
selection_caret_(0),
selection_anchor_(0),
pending_user_gesture_(0.0),
- flash_impl_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ flash_impl_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ decryptor_client_(NULL),
+ next_decryption_request_id_(1) {
pp_instance_ = HostGlobals::Get()->AddInstance(this);
memset(&current_print_settings_, 0, sizeof(current_print_settings_));
@@ -1330,12 +1390,19 @@ void PluginInstance::RotateView(WebPlugin::RotationType type) {
// NOTE: plugin instance may have been deleted.
}
+void PluginInstance::set_decrypt_client(
+ media::DecryptorClient* decryptor_client) {
+ DCHECK(decryptor_client);
+ decryptor_client_ = decryptor_client;
+}
+
bool PluginInstance::GenerateKeyRequest(const std::string& key_system,
const std::string& init_data) {
if (!LoadContentDecryptorInterface())
return false;
if (key_system.empty())
return false;
+
PP_Var init_data_array =
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
init_data.size(), init_data.data());
@@ -1375,39 +1442,58 @@ bool PluginInstance::CancelKeyRequest(const std::string& session_id) {
StringVar::StringToPPVar(session_id)));
}
-bool PluginInstance::Decrypt(const base::StringPiece& encrypted_block,
- const DecryptedDataCB& callback) {
+bool PluginInstance::Decrypt(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
+ const media::Decryptor::DecryptCB& decrypt_cb) {
if (!LoadContentDecryptorInterface())
return false;
- ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(),
- encrypted_block));
+
+ ScopedPPResource encrypted_resource(
+ MakeBufferResource(pp_instance(),
+ encrypted_buffer->GetData(),
+ encrypted_buffer->GetDataSize()));
if (!encrypted_resource.get())
return false;
+ uint32_t request_id = next_decryption_request_id_++;
+
PP_EncryptedBlockInfo block_info;
+ DCHECK(encrypted_buffer->GetDecryptConfig());
+ if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
+ encrypted_buffer->GetTimestamp().InMicroseconds(),
+ request_id,
+ &block_info)) {
+ return false;
+ }
+
+ DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
+ pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
- // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(),
encrypted_resource,
&block_info));
}
-bool PluginInstance::DecryptAndDecode(const base::StringPiece& encrypted_block,
- const DecryptedDataCB& callback) {
+bool PluginInstance::DecryptAndDecode(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
+ const media::Decryptor::DecryptCB& decrypt_cb) {
if (!LoadContentDecryptorInterface())
return false;
- ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(),
- encrypted_block));
+
+ ScopedPPResource encrypted_resource(MakeBufferResource(
+ pp_instance(),
+ encrypted_buffer->GetData(),
+ encrypted_buffer->GetDataSize()));
if (!encrypted_resource.get())
return false;
PP_EncryptedBlockInfo block_info;
// TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
- return PP_ToBool(plugin_decryption_interface_->DecryptAndDecode(
- pp_instance(),
- encrypted_resource,
- &block_info));
+ return PP_ToBool(
+ plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
+ encrypted_resource,
+ &block_info));
}
bool PluginInstance::FlashIsFullscreenOrPending() {
@@ -2020,7 +2106,16 @@ void PluginInstance::NeedKey(PP_Instance instance,
void PluginInstance::KeyAdded(PP_Instance instance,
PP_Var key_system_var,
PP_Var session_id_var) {
- // TODO(tomfinegan): send the data to media stack.
+ StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
+ StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
+ if (!key_system_string || !session_id_string) {
+ decryptor_client_->KeyError("", "", media::Decryptor::kUnknownError, 0);
+ return;
+ }
+
+ DCHECK(decryptor_client_);
+ decryptor_client_->KeyAdded(key_system_string->value(),
+ session_id_string->value());
}
void PluginInstance::KeyMessage(PP_Instance instance,
@@ -2028,7 +2123,35 @@ void PluginInstance::KeyMessage(PP_Instance instance,
PP_Var session_id_var,
PP_Resource message_resource,
PP_Var default_url_var) {
- // TODO(tomfinegan): send the data to media stack.
+ StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
+ StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
+ StringVar* default_url_string = StringVar::FromPPVar(default_url_var);
+
+ if (!key_system_string || !session_id_string || !default_url_string) {
+ decryptor_client_->KeyError("", "", media::Decryptor::kUnknownError, 0);
+ return;
+ }
+
+ EnterResourceNoLock<PPB_Buffer_API> enter(message_resource, true);
+ if (!enter.succeeded()) {
+ decryptor_client_->KeyError(key_system_string->value(),
+ session_id_string->value(),
+ media::Decryptor::kUnknownError,
+ 0);
+ return;
+ }
+
+ BufferAutoMapper mapper(enter.object());
+ scoped_array<uint8> message_array(new uint8[mapper.size()]);
+ if (mapper.data() && mapper.size())
+ memcpy(message_array.get(), mapper.data(), mapper.size());
+
+ DCHECK(decryptor_client_);
+ decryptor_client_->KeyMessage(key_system_string->value(),
+ session_id_string->value(),
+ message_array.Pass(),
+ mapper.size(),
+ default_url_string->value());
}
void PluginInstance::KeyError(PP_Instance instance,
@@ -2036,13 +2159,60 @@ void PluginInstance::KeyError(PP_Instance instance,
PP_Var session_id_var,
int32_t media_error,
int32_t system_code) {
- // TODO(tomfinegan): send the data to media stack.
+ StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
+ StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
+ if (!key_system_string || !session_id_string) {
+ decryptor_client_->KeyError("", "", media::Decryptor::kUnknownError, 0);
+ return;
+ }
+
+ DCHECK(decryptor_client_);
+ decryptor_client_->KeyError(
+ key_system_string->value(),
+ session_id_string->value(),
+ static_cast<media::Decryptor::KeyError>(media_error),
+ system_code);
}
void PluginInstance::DeliverBlock(PP_Instance instance,
PP_Resource decrypted_block,
const PP_DecryptedBlockInfo* block_info) {
- // TODO(xhwang): Pass the decrypted block back to media stack.
+ DCHECK(block_info);
+
+ DecryptionCBMap::iterator found = pending_decryption_cbs_.find(
+ block_info->tracking_info.request_id);
+
+ if (found == pending_decryption_cbs_.end())
+ return;
+ media::Decryptor::DecryptCB decrypt_cb = found->second;
+ pending_decryption_cbs_.erase(found);
+
+ if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) {
+ decrypt_cb.Run(media::Decryptor::kNoKey, NULL);
+ return;
+ }
+ if (block_info->result != PP_DECRYPTRESULT_SUCCESS) {
+ decrypt_cb.Run(media::Decryptor::kError, NULL);
+ return;
+ }
+ EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
+
+ if (!enter.succeeded()) {
+ decrypt_cb.Run(media::Decryptor::kError, NULL);
+ return;
+ }
+ BufferAutoMapper mapper(enter.object());
+ if (!mapper.data() || !mapper.size()) {
+ decrypt_cb.Run(media::Decryptor::kError, NULL);
+ return;
+ }
+
+ scoped_refptr<media::DecoderBuffer> decrypted_buffer(
+ media::DecoderBuffer::CopyFrom(
+ reinterpret_cast<const uint8*>(mapper.data()), mapper.size()));
+ decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds(
+ block_info->tracking_info.timestamp));
+ decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer);
}
void PluginInstance::DeliverFrame(PP_Instance instance,
@@ -2059,7 +2229,6 @@ void PluginInstance::DeliverSamples(PP_Instance instance,
// EME/CDM work.
}
-
void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance,
int32_t total,
PP_Bool final_result) {
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index a136460..84e90a1 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
#define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
+#include <map>
#include <set>
#include <string>
#include <vector>
@@ -17,6 +18,7 @@
#include "base/memory/weak_ptr.h"
#include "base/string16.h"
#include "googleurl/src/gurl.h"
+#include "media/base/decryptor.h"
#include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/dev/ppp_find_dev.h"
@@ -69,6 +71,11 @@ struct WebCursorInfo;
struct WebPrintParams;
}
+namespace media {
+class DecoderBuffer;
+class DecryptorClient;
+}
+
namespace ppapi {
struct InputEventData;
struct PPP_Instance_Combined;
@@ -243,17 +250,19 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// Provides access to PPP_ContentDecryptor_Private.
// TODO(tomfinegan): Move decryptor methods to delegate class.
- typedef base::Callback<void(void*, int)> DecryptedDataCB;
+ void set_decrypt_client(media::DecryptorClient* client);
bool GenerateKeyRequest(const std::string& key_system,
const std::string& init_data);
bool AddKey(const std::string& session_id,
const std::string& key,
const std::string& init_data);
bool CancelKeyRequest(const std::string& session_id);
- bool Decrypt(const base::StringPiece& encypted_block,
- const DecryptedDataCB& callback);
- bool DecryptAndDecode(const base::StringPiece& encypted_block,
- const DecryptedDataCB& callback);
+ bool Decrypt(const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
+ const media::Decryptor::DecryptCB& decrypt_cb);
+ // TODO(xhwang): Update this when we need to support decrypt and decode.
+ bool DecryptAndDecode(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
+ const media::Decryptor::DecryptCB& decrypt_cb);
// There are 2 implementations of the fullscreen interface
// PPB_FlashFullscreen is used by Pepper Flash.
@@ -337,7 +346,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
void OnLockMouseACK(bool succeeded);
// A mouse lock was in place, but has been lost.
void OnMouseLockLost();
- // A mouse lock is enabled and mouse events are being delievered.
+ // A mouse lock is enabled and mouse events are being delivered.
void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event);
// Simulates an input event to the plugin by passing it down to WebKit,
@@ -465,7 +474,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// number of interfaces implemented by PluginInstance.
class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API {
public:
- GamepadImpl(PluginDelegate* delegate);
+ explicit GamepadImpl(PluginDelegate* delegate);
virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE;
private:
PluginDelegate* delegate_;
@@ -739,6 +748,11 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// the pointer so we can re-send it later if we are reset to talk to NaCl.
scoped_refptr<PPB_URLLoader_Impl> document_loader_;
+ media::DecryptorClient* decryptor_client_;
+ uint32_t next_decryption_request_id_;
+ typedef std::map<uint32_t, media::Decryptor::DecryptCB> DecryptionCBMap;
+ DecryptionCBMap pending_decryption_cbs_;
+
DISALLOW_COPY_AND_ASSIGN(PluginInstance);
};