Chromium Code Reviews| Index: media/mojo/services/mojo_cdm_service_context.h |
| diff --git a/media/mojo/services/mojo_cdm_service_context.h b/media/mojo/services/mojo_cdm_service_context.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..41ce5886f733025eabcadd5739bc2b0270312f34 |
| --- /dev/null |
| +++ b/media/mojo/services/mojo_cdm_service_context.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2015 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_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |
| +#define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |
| + |
| +#include "base/containers/scoped_ptr_hash_map.h" |
| +#include "base/macros.h" |
| +#include "media/base/cdm_context.h" |
| +#include "media/base/media_export.h" |
| +#include "media/mojo/services/mojo_cdm_service.h" |
| + |
| +namespace media { |
| + |
| +// A class that creates, owns and manages all MojoCdmService instances. |
| +class MEDIA_EXPORT MojoCdmServiceContext : public CdmContextProvider { |
| + public: |
| + MojoCdmServiceContext(); |
| + ~MojoCdmServiceContext() override; |
| + |
| + // Creates and returns a MojoCdmService for |key_system|, |security_origin| |
|
ddorwin
2015/05/15 19:10:07
"for" doesn't really apply to the last two paramet
xhwang
2015/06/01 21:21:25
Done.
|
| + // and |cdm_id|. The returned MojoCdmService is owned by |this|. Returns |
| + // nullptr if no MojoCdmService can be created. |
| + MojoCdmService* Create(const mojo::String& key_system, |
| + const mojo::String& security_origin, |
| + int32_t cdm_id); |
| + |
| + // CdmContextProvider implementation. |
| + CdmContext* GetCdmContext(int32_t cdm_id) override; |
|
ddorwin
2015/05/15 19:10:07
Why wouldn't a caller just get the context from th
xhwang
2015/06/01 21:21:25
The caller (MojoRendererService) needs to find the
|
| + |
| + // Called when there is a connection error with |service|. |
| + void ServiceHadConnectionError(MojoCdmService* service); |
| + |
| + private: |
| + // A map between CDM IDs and MojoCdnServices, which owns all MojoCdmServices |
|
ddorwin
2015/05/15 19:10:07
typo: "Cdn"
grammar: ", which" refers to MojoCdnS
xhwang
2015/06/01 21:21:25
Done.
|
| + // created. |
| + base::ScopedPtrHashMap<int32_t, MojoCdmService> services_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MojoCdmServiceContext); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |