Chromium Code Reviews| Index: content/renderer/media/webcontentdecryptionmoduleresult_helper.h |
| diff --git a/content/renderer/media/webcontentdecryptionmoduleresult_helper.h b/content/renderer/media/webcontentdecryptionmoduleresult_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6e48a520a1f8efbaba0268494bf357b961fb8ce2 |
| --- /dev/null |
| +++ b/content/renderer/media/webcontentdecryptionmoduleresult_helper.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 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 CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ |
| +#define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
|
ddorwin
2014/09/23 18:57:31
not used
jrummell
2014/09/23 22:36:35
Done.
|
| +#include "media/base/media_keys.h" |
|
ddorwin
2014/09/23 18:57:31
used?
jrummell
2014/09/23 22:36:35
Needed for SimpleCdmPromise, NewSessionCdmPromise,
|
| +#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| + |
| +namespace content { |
| + |
| +typedef base::Callback<blink::WebContentDecryptionModuleResult::SessionStatus( |
| + const std::string& web_session_id)> NewSessionCreatedCB; |
| + |
| +class WebContentDecryptionModuleResultHelper { |
| + public: |
| + // Take a copy of |result| and keep it around until needed. Returns a |
|
ddorwin
2014/09/23 18:57:31
s/Take/Make/
ddorwin
2014/09/23 18:57:31
The copy is an impl detail. The first sentence sho
jrummell
2014/09/23 22:36:35
Done.
jrummell
2014/09/23 22:36:35
Done.
|
| + // SimpleCdmPromise that can be passed to the other methods to complete the |
| + // WebContentDecryptionModuleResult. When SimpleCdmPromise is resolved, |
| + // Complete() is called. If the SimpleCdmPromise is rejected, |
| + // CompleteWithError() is called. |
| + static scoped_ptr<media::SimpleCdmPromise> CreateSimpleCdmPromise( |
| + blink::WebContentDecryptionModuleResult result); |
| + |
| + // Returns a NewSessionCdmPromise that can be passed to the other methods to |
| + // complete the WebContentDecryptionModuleResult. When NewSessionCdmPromise is |
| + // resolved, |new_session_created_cb| is called, and then the return value |
| + // passed to CompleteWithSession(). If the NewSessionCdmPromise is rejected, |
| + // CompleteWithError() is called, and |new_session_created_cb| is not called. |
| + // |uma_name| is the name of a CdmPromiseResult UMA, and is used to report |
| + // the promise result (success or rejection code). |
| + static scoped_ptr<media::NewSessionCdmPromise> CreateNewSessionCdmPromise( |
| + blink::WebContentDecryptionModuleResult result, |
| + const NewSessionCreatedCB& new_session_created_cb, |
|
ddorwin
2014/09/23 18:57:31
Is it a goal to eliminate this CB someday?
jrummell
2014/09/23 22:36:35
Somebody has to decide if this is a new session, a
|
| + std::string uma_name); |
|
ddorwin
2014/09/23 18:57:31
Why does only this one have a UMA? Do we not repor
jrummell
2014/09/23 22:36:35
UMA is only done for CreateSession. However, all C
|
| + |
| + // Take a copy of |result| and keep it around until needed. Returns a |
| + // KeyIdsPromise that can be passed to the other methods to complete the |
| + // WebContentDecryptionModuleResult. When KeyIdsPromise is resolved, |
| + // CompleteWithKeyIds() is called. If the KeyIdsPromise is rejected, |
| + // CompleteWithError() is called. |
| + static scoped_ptr<media::KeyIdsPromise> CreateKeyIdsPromise( |
| + blink::WebContentDecryptionModuleResult result); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleResultHelper); |
|
ddorwin
2014/09/23 18:57:31
DISALLOW_IMPLICIT_CONSTRUCTORS - it should never b
jrummell
2014/09/23 22:36:35
Done.
|
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULERESULT_HELPER_H_ |