OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_DRM_STORAGE_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_DRM_STORAGE_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/android/media_drm_storage.h" |
| 12 #include "media/mojo/interfaces/media_drm_storage.mojom.h" |
| 13 #include "media/mojo/services/media_mojo_export.h" |
| 14 |
| 15 namespace media { |
| 16 |
| 17 // A MediaDrmStorage that proxies to a mojom::MediaDrmStoragePtr. |
| 18 class MEDIA_MOJO_EXPORT MojoMediaDrmStorage |
| 19 : NON_EXPORTED_BASE(public MediaDrmStorage) { |
| 20 public: |
| 21 explicit MojoMediaDrmStorage(mojom::MediaDrmStoragePtr media_drm_storage_ptr); |
| 22 ~MojoMediaDrmStorage() final; |
| 23 |
| 24 // MediaDrmStorage implementation: |
| 25 void Initialize(const url::Origin& origin) final; |
| 26 void OnProvisioned(ResultCB result_cb) final; |
| 27 void SavePersistentSession(const std::string& session_id, |
| 28 const std::vector<uint8_t>& key_set_id, |
| 29 const std::string& mime_type, |
| 30 ResultCB result_cb) final; |
| 31 void LoadPersistentSession( |
| 32 const std::string& session_id, |
| 33 LoadPersistentSessionCB load_persistent_session_cb) final; |
| 34 void RemovePersistentSession(const std::string& session_id, |
| 35 ResultCB result_cb) final; |
| 36 |
| 37 private: |
| 38 void OnResult(ResultCB result_cb, bool success); |
| 39 void OnPersistentSessionLoaded( |
| 40 LoadPersistentSessionCB load_persistent_session_cb, |
| 41 bool success, |
| 42 const std::vector<uint8_t>& key_set_id, |
| 43 const std::string& mime_type); |
| 44 |
| 45 mojom::MediaDrmStoragePtr media_drm_storage_ptr_; |
| 46 base::WeakPtrFactory<MojoMediaDrmStorage> weak_factory_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(MojoMediaDrmStorage); |
| 49 }; |
| 50 |
| 51 } // namespace media |
| 52 |
| 53 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_DRM_STORAGE_H_ |
OLD | NEW |