Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / mojo / services / mojo_cdm_factory.cc
blob072b2ddd28a732f78abe36a311b2ee00494cb6e1
1 // Copyright 2015 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.
5 #include "media/mojo/services/mojo_cdm_factory.h"
7 #include "media/mojo/interfaces/service_factory.mojom.h"
8 #include "media/mojo/services/mojo_cdm.h"
9 #include "mojo/application/public/cpp/connect.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
12 namespace media {
14 MojoCdmFactory::MojoCdmFactory(interfaces::ServiceFactory* service_factory)
15 : service_factory_(service_factory) {
16 DCHECK(service_factory_);
19 MojoCdmFactory::~MojoCdmFactory() {
22 void MojoCdmFactory::Create(
23 const std::string& key_system,
24 const GURL& security_origin,
25 const CdmConfig& cdm_config,
26 const SessionMessageCB& session_message_cb,
27 const SessionClosedCB& session_closed_cb,
28 const LegacySessionErrorCB& legacy_session_error_cb,
29 const SessionKeysChangeCB& session_keys_change_cb,
30 const SessionExpirationUpdateCB& session_expiration_update_cb,
31 const CdmCreatedCB& cdm_created_cb) {
32 DVLOG(2) << __FUNCTION__ << ": " << key_system;
33 DCHECK(service_factory_);
35 interfaces::ContentDecryptionModulePtr cdm_ptr;
36 service_factory_->CreateCdm(mojo::GetProxy(&cdm_ptr));
38 MojoCdm::Create(key_system, security_origin, cdm_config, cdm_ptr.Pass(),
39 session_message_cb, session_closed_cb,
40 legacy_session_error_cb, session_keys_change_cb,
41 session_expiration_update_cb, cdm_created_cb);
44 } // namespace media