1 // Copyright 2014 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 "chromecast/browser/media/cast_browser_cdm_factory.h"
7 #include "chromecast/media/cdm/browser_cdm_cast.h"
12 scoped_ptr
< ::media::BrowserCdm
> CastBrowserCdmFactory::CreateBrowserCdm(
13 const std::string
& key_system_name
,
14 const ::media::SessionMessageCB
& session_message_cb
,
15 const ::media::SessionClosedCB
& session_closed_cb
,
16 const ::media::SessionErrorCB
& session_error_cb
,
17 const ::media::SessionKeysChangeCB
& session_keys_change_cb
,
18 const ::media::SessionExpirationUpdateCB
& session_expiration_update_cb
) {
19 CastKeySystem
key_system(GetKeySystemByName(key_system_name
));
21 scoped_ptr
<chromecast::media::BrowserCdmCast
> browser_cdm
;
22 if (key_system
== chromecast::media::KEY_SYSTEM_CLEAR_KEY
) {
23 // TODO(gunsch): handle ClearKey decryption. See crbug.com/441957
25 browser_cdm
= CreatePlatformBrowserCdm(key_system
);
29 browser_cdm
->SetCallbacks(session_message_cb
,
32 session_keys_change_cb
,
33 session_expiration_update_cb
);
34 return browser_cdm
.Pass();
37 LOG(INFO
) << "No matching key system found.";
38 return scoped_ptr
< ::media::BrowserCdm
>();
42 } // namespace chromecast