Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / media / blink / null_encrypted_media_player_support.h
blob3b53ad24ab28f7857c0edede0f55915146c61527
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 #ifndef MEDIA_BLINK_NULL_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
6 #define MEDIA_BLINK_NULL_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
8 #include "media/base/media_export.h"
9 #include "media/blink/encrypted_media_player_support.h"
11 namespace media {
13 // A "null" implementation of the EncryptedMediaPlayerSupport interface
14 // that indicates all key systems are not supported. This makes sure that
15 // any attempts to play encrypted content always fail.
16 class MEDIA_EXPORT NullEncryptedMediaPlayerSupport
17 : public EncryptedMediaPlayerSupport {
18 public:
19 static scoped_ptr<EncryptedMediaPlayerSupport> Create(
20 blink::WebMediaPlayerClient* client);
22 ~NullEncryptedMediaPlayerSupport() override;
24 // Prefixed API methods.
25 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest(
26 blink::WebLocalFrame* frame,
27 const blink::WebString& key_system,
28 const unsigned char* init_data,
29 unsigned init_data_length) override;
31 blink::WebMediaPlayer::MediaKeyException AddKey(
32 const blink::WebString& key_system,
33 const unsigned char* key,
34 unsigned key_length,
35 const unsigned char* init_data,
36 unsigned init_data_length,
37 const blink::WebString& session_id) override;
39 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest(
40 const blink::WebString& key_system,
41 const blink::WebString& session_id) override;
43 // Unprefixed API methods.
44 void SetInitialContentDecryptionModule(
45 blink::WebContentDecryptionModule* initial_cdm) override;
46 void SetContentDecryptionModule(
47 blink::WebContentDecryptionModule* cdm) override;
48 void SetContentDecryptionModule(
49 blink::WebContentDecryptionModule* cdm,
50 blink::WebContentDecryptionModuleResult result) override;
52 // Callback factory and notification methods used by WebMediaPlayerImpl.
54 // Creates a callback that Demuxers can use to signal that the content
55 // requires a key. This method makes sure the callback returned can be safely
56 // invoked from any thread.
57 Demuxer::NeedKeyCB CreateNeedKeyCB() override;
59 // Creates a callback that renderers can use to set decryptor
60 // ready callback. This method makes sure the callback returned can be safely
61 // invoked from any thread.
62 SetDecryptorReadyCB CreateSetDecryptorReadyCB() override;
64 // Called to inform this object that the media pipeline encountered
65 // and handled a decryption error.
66 void OnPipelineDecryptError() override;
68 private:
69 NullEncryptedMediaPlayerSupport();
71 DISALLOW_COPY_AND_ASSIGN(NullEncryptedMediaPlayerSupport);
74 } // namespace media
76 #endif // MEDIA_BLINK_NULL_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_