Skip to content

Commit

Permalink
Remove |origin| from AesDecryptor's constructor
Browse files Browse the repository at this point in the history
As the origin is not used by AesDecryptor, remove it from the constructor
to simplify things.

BUG=478960
TEST=media_unittests pass

Change-Id: I691f0b0ca19d00eb43d342d86ccfcd52f61ecb6a
Reviewed-on: https://chromium-review.googlesource.com/644577
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Commit-Queue: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498753}
  • Loading branch information
jrummell-chromium authored and Commit Bot committed Aug 31, 2017
1 parent d2bc9ed commit 5d5da6c
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 39 deletions.
4 changes: 2 additions & 2 deletions content/renderer/media/cdm/render_cdm_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void RenderCdmFactory::Create(
DCHECK(!cdm_config.allow_distinctive_identifier);
DCHECK(!cdm_config.allow_persistent_state);
scoped_refptr<media::ContentDecryptionModule> cdm(new media::AesDecryptor(
security_origin, session_message_cb, session_closed_cb,
session_keys_change_cb, session_expiration_update_cb));
session_message_cb, session_closed_cb, session_keys_change_cb,
session_expiration_update_cb));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(cdm_created_cb, cdm, ""));
return;
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/android_cdm_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void AndroidCdmFactory::Create(
if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting) &&
IsExternalClearKey(key_system)) {
scoped_refptr<ContentDecryptionModule> cdm(
new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
new AesDecryptor(session_message_cb, session_closed_cb,
session_keys_change_cb, session_expiration_update_cb));
bound_cdm_created_cb.Run(cdm, "");
return;
Expand Down
1 change: 0 additions & 1 deletion media/cdm/aes_decryptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ static scoped_refptr<DecoderBuffer> DecryptData(
}

AesDecryptor::AesDecryptor(
const url::Origin& /* security_origin */,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
Expand Down
7 changes: 1 addition & 6 deletions media/cdm/aes_decryptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ namespace crypto {
class SymmetricKey;
}

namespace url {
class Origin;
}

namespace media {

// Decrypts an AES encrypted buffer into an unencrypted buffer. The AES
Expand All @@ -39,8 +35,7 @@ class MEDIA_EXPORT AesDecryptor : public ContentDecryptionModule,
public CdmContext,
public Decryptor {
public:
AesDecryptor(const url::Origin& security_origin,
const SessionMessageCB& session_message_cb,
AesDecryptor(const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
const SessionExpirationUpdateCB& session_expiration_update_cb);
Expand Down
4 changes: 1 addition & 3 deletions media/cdm/aes_decryptor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest-param-test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"

#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
#include "media/cdm/api/content_decryption_module.h"
Expand Down Expand Up @@ -260,8 +259,7 @@ class AesDecryptorTest : public testing::TestWithParam<TestType> {
void SetUp() override {
if (GetParam() == TestType::kAesDecryptor) {
OnCdmCreated(
new AesDecryptor(url::Origin(),
base::Bind(&MockCdmClient::OnSessionMessage,
new AesDecryptor(base::Bind(&MockCdmClient::OnSessionMessage,
base::Unretained(&cdm_client_)),
base::Bind(&MockCdmClient::OnSessionClosed,
base::Unretained(&cdm_client_)),
Expand Down
2 changes: 1 addition & 1 deletion media/cdm/default_cdm_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void DefaultCdmFactory::Create(
}

scoped_refptr<ContentDecryptionModule> cdm(
new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
new AesDecryptor(session_message_cb, session_closed_cb,
session_keys_change_cb, session_expiration_update_cb));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(cdm_created_cb, cdm, ""));
Expand Down
9 changes: 2 additions & 7 deletions media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "media/cdm/json_web_key.h"
#include "media/cdm/ppapi/cdm_file_io_test.h"
#include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h"
#include "url/origin.h"

#if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
const int64_t kNoTimestamp = INT64_MIN;
Expand Down Expand Up @@ -270,8 +269,7 @@ void* CreateCdmInstance(int cdm_interface_version,
if (!host)
return nullptr;

// TODO(jrummell): Obtain the proper origin for this instance.
return new media::ClearKeyCdm(host, key_system_string, url::Origin());
return new media::ClearKeyCdm(host, key_system_string);
}

const char* GetCdmVersion() {
Expand Down Expand Up @@ -334,11 +332,8 @@ bool VerifyCdmHost_0(const cdm::HostFile* host_files, uint32_t num_files) {

namespace media {

ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host,
const std::string& key_system,
const url::Origin& origin)
ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host, const std::string& key_system)
: cdm_(new ClearKeyPersistentSessionCdm(
origin,
host,
base::Bind(&ClearKeyCdm::OnSessionMessage, base::Unretained(this)),
base::Bind(&ClearKeyCdm::OnSessionClosed, base::Unretained(this)),
Expand Down
8 changes: 1 addition & 7 deletions media/cdm/ppapi/external_clear_key/clear_key_cdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
#endif

namespace url {
class Origin;
}

namespace media {
class CdmVideoDecoder;
class DecoderBuffer;
Expand All @@ -39,9 +35,7 @@ class FileIOTestRunner;
// Clear key implementation of the cdm::ContentDecryptionModule interface.
class ClearKeyCdm : public ClearKeyCdmInterface {
public:
ClearKeyCdm(Host* host,
const std::string& key_system,
const url::Origin& origin);
ClearKeyCdm(Host* host, const std::string& key_system);
~ClearKeyCdm() override;

// ClearKeyCdmInterface implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "media/base/cdm_promise.h"
#include "url/origin.h"

namespace media {

Expand Down Expand Up @@ -88,15 +87,14 @@ class FinishLoadCdmPromise : public SimpleCdmPromise {
} // namespace

ClearKeyPersistentSessionCdm::ClearKeyPersistentSessionCdm(
const url::Origin& origin,
ClearKeyCdmHost* host,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
const SessionExpirationUpdateCB& session_expiration_update_cb)
: host_(host), session_closed_cb_(session_closed_cb), weak_factory_(this) {
cdm_ = base::MakeRefCounted<AesDecryptor>(
origin, session_message_cb,
session_message_cb,
base::Bind(&ClearKeyPersistentSessionCdm::OnSessionClosed,
weak_factory_.GetWeakPtr()),
session_keys_change_cb, session_expiration_update_cb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include "media/cdm/cdm_file_adapter.h"
#include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h"

namespace url {
class Origin;
}

namespace media {

// This class is a wrapper on top of AesDecryptor that supports persistent
Expand All @@ -32,7 +28,6 @@ namespace media {
class ClearKeyPersistentSessionCdm : public ContentDecryptionModule {
public:
ClearKeyPersistentSessionCdm(
const url::Origin& origin,
ClearKeyCdmHost* host,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
Expand Down
2 changes: 1 addition & 1 deletion media/mojo/clients/mojo_cdm_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void MojoCdmFactory::Create(
#if !BUILDFLAG(ENABLE_MOJO_RENDERER)
if (CanUseAesDecryptor(key_system)) {
scoped_refptr<ContentDecryptionModule> cdm(
new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
new AesDecryptor(session_message_cb, session_closed_cb,
session_keys_change_cb, session_expiration_update_cb));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(cdm_created_cb, cdm, ""));
Expand Down
2 changes: 0 additions & 2 deletions media/test/fake_encrypted_media.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "base/bind.h"
#include "media/base/cdm_key_information.h"
#include "media/cdm/aes_decryptor.h"
#include "url/origin.h"

namespace media {

Expand All @@ -24,7 +23,6 @@ int FakeEncryptedMedia::TestCdmContext::GetCdmId() const {

FakeEncryptedMedia::FakeEncryptedMedia(AppBase* app)
: decryptor_(new AesDecryptor(
url::Origin(),
base::Bind(&FakeEncryptedMedia::OnSessionMessage,
base::Unretained(this)),
base::Bind(&FakeEncryptedMedia::OnSessionClosed,
Expand Down

0 comments on commit 5d5da6c

Please sign in to comment.