summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/webcontentdecryptionmodule_impl.h
blob: 27c79c0c600b7cdae5da847695a75983b67853db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
#define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"

namespace media {
class MediaKeys;
}

namespace content {

class WebContentDecryptionModuleSessionImpl;
class ReferenceIdAdapter;

class WebContentDecryptionModuleImpl
    : public blink::WebContentDecryptionModule {
 public:
  static WebContentDecryptionModuleImpl* Create(
      const base::string16& key_system);

  virtual ~WebContentDecryptionModuleImpl();

  // blink::WebContentDecryptionModule implementation.
  virtual blink::WebContentDecryptionModuleSession* createSession(
      blink::WebContentDecryptionModuleSession::Client* client);

 private:
  // Takes ownership of |media_keys| and |adapter|.
  WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys,
                                 scoped_ptr<ReferenceIdAdapter> adapter);

  // Called when a WebContentDecryptionModuleSessionImpl is closed.
  void OnSessionClosed(uint32 reference_id);

  scoped_ptr<media::MediaKeys> media_keys_;
  scoped_ptr<ReferenceIdAdapter> adapter_;

  DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
};

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_