summaryrefslogtreecommitdiff
path: root/chromium/media/blink/webcontentdecryptionmoduleaccess_impl.h
blob: 629878a3ea6cc2689b95a2d988b8cc5d2683d144 (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
52
53
54
55
56
57
58
// 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 MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_
#define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "media/base/cdm_config.h"
#include "third_party/WebKit/public/platform/WebContentDecryptionModuleAccess.h"
#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
#include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/WebString.h"

namespace media {

class WebEncryptedMediaClientImpl;

class WebContentDecryptionModuleAccessImpl
    : public blink::WebContentDecryptionModuleAccess {
 public:
  static WebContentDecryptionModuleAccessImpl* Create(
      const blink::WebString& key_system,
      const blink::WebSecurityOrigin& security_origin,
      const blink::WebMediaKeySystemConfiguration& configuration,
      const CdmConfig& cdm_config,
      const base::WeakPtr<WebEncryptedMediaClientImpl>& client);
  ~WebContentDecryptionModuleAccessImpl() override;

  // blink::WebContentDecryptionModuleAccess interface.
  blink::WebMediaKeySystemConfiguration getConfiguration() override;
  void createContentDecryptionModule(
      blink::WebContentDecryptionModuleResult result) override;

 private:
  WebContentDecryptionModuleAccessImpl(
      const blink::WebString& key_system,
      const blink::WebSecurityOrigin& security_origin,
      const blink::WebMediaKeySystemConfiguration& configuration,
      const CdmConfig& cdm_config,
      const base::WeakPtr<WebEncryptedMediaClientImpl>& client);

  const blink::WebString key_system_;
  const blink::WebSecurityOrigin security_origin_;
  const blink::WebMediaKeySystemConfiguration configuration_;
  const CdmConfig cdm_config_;

  // Keep a WeakPtr as client is owned by render_frame_impl.
  base::WeakPtr<WebEncryptedMediaClientImpl> client_;

  DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleAccessImpl);
};

}  // namespace media

#endif  // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_