[App banners] Add RAPPOR support
[chromium-blink-merge.git] / media / base / cdm_context.h
blob2a3e8cd25ded665e6daf630152924b1f2b8a7d4d
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_BASE_CDM_CONTEXT_H_
6 #define MEDIA_BASE_CDM_CONTEXT_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "media/base/media_export.h"
12 namespace media {
14 class Decryptor;
16 // An interface representing the context that a media pipeline needs from a
17 // content decryption module (CDM) to decrypt (and decode) encrypted buffers.
18 class MEDIA_EXPORT CdmContext {
19 public:
20 #if defined(ENABLE_BROWSER_CDMS)
21 static const int kInvalidCdmId = 0;
22 #endif
24 virtual ~CdmContext();
26 // Gets the Decryptor object associated with the CDM. Returns NULL if no
27 // Decryptor object is associated. The returned object is only guaranteed
28 // to be valid during the CDM's lifetime.
29 virtual Decryptor* GetDecryptor() = 0;
31 #if defined(ENABLE_BROWSER_CDMS)
32 // Returns the CDM ID associated with |this|. May be kInvalidCdmId if no CDM
33 // ID is associated.
34 virtual int GetCdmId() const = 0;
35 #endif
37 protected:
38 CdmContext();
40 private:
41 DISALLOW_COPY_AND_ASSIGN(CdmContext);
44 // Callback to notify that the CdmContext has been completely attached to
45 // the media pipeline. Parameter indicates whether the operation succeeded.
46 typedef base::Callback<void(bool)> CdmAttachedCB;
48 // A dummy implementation of CdmAttachedCB.
49 MEDIA_EXPORT void IgnoreCdmAttached(bool success);
51 } // namespace media
53 #endif // MEDIA_BASE_CDM_CONTEXT_H_