Revert of ui: Clean up damaged rects and clear them after painting. (patchset #2...
[chromium-blink-merge.git] / media / cdm / default_cdm_factory.cc
blob202f3cdcf21d643c2c4c400e85a70f3119e801f3
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 "media/cdm/default_cdm_factory.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h"
11 #include "media/base/key_systems.h"
12 #include "media/cdm/aes_decryptor.h"
13 #include "url/gurl.h"
15 namespace media {
17 DefaultCdmFactory::DefaultCdmFactory() {
20 DefaultCdmFactory::~DefaultCdmFactory() {
23 void DefaultCdmFactory::Create(
24 const std::string& key_system,
25 bool allow_distinctive_identifier,
26 bool allow_persistent_state,
27 const GURL& security_origin,
28 const SessionMessageCB& session_message_cb,
29 const SessionClosedCB& session_closed_cb,
30 const LegacySessionErrorCB& legacy_session_error_cb,
31 const SessionKeysChangeCB& session_keys_change_cb,
32 const SessionExpirationUpdateCB& session_expiration_update_cb,
33 const CdmCreatedCB& cdm_created_cb) {
34 if (!security_origin.is_valid() || !CanUseAesDecryptor(key_system)) {
35 base::MessageLoopProxy::current()->PostTask(
36 FROM_HERE, base::Bind(cdm_created_cb, nullptr));
37 return;
40 scoped_ptr<MediaKeys> cdm(
41 new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
42 session_keys_change_cb));
43 base::MessageLoopProxy::current()->PostTask(
44 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm)));
47 } // namespace media