| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ | 5 #ifndef MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ |
| 6 #define MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ | 6 #define MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "media/base/cdm_promise.h" | 11 #include "media/base/cdm_promise.h" |
| 12 #include "media/base/media_export.h" | |
| 13 #include "media/base/media_keys.h" | 12 #include "media/base/media_keys.h" |
| 13 #include "media/blink/media_blink_export.h" |
| 14 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 14 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 enum class SessionInitStatus { | 18 enum class SessionInitStatus { |
| 19 // Error creating the session. | 19 // Error creating the session. |
| 20 UNKNOWN_STATUS, | 20 UNKNOWN_STATUS, |
| 21 | 21 |
| 22 // New session has been initialized. | 22 // New session has been initialized. |
| 23 NEW_SESSION, | 23 NEW_SESSION, |
| 24 | 24 |
| 25 // CDM could not find the requested session. | 25 // CDM could not find the requested session. |
| 26 SESSION_NOT_FOUND, | 26 SESSION_NOT_FOUND, |
| 27 | 27 |
| 28 // CDM already has a non-closed session that matches the provided | 28 // CDM already has a non-closed session that matches the provided |
| 29 // parameters. | 29 // parameters. |
| 30 SESSION_ALREADY_EXISTS | 30 SESSION_ALREADY_EXISTS |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 typedef base::Callback<void(const std::string& session_id, | 33 typedef base::Callback<void(const std::string& session_id, |
| 34 SessionInitStatus* status)> SessionInitializedCB; | 34 SessionInitStatus* status)> SessionInitializedCB; |
| 35 | 35 |
| 36 // Special class for resolving a new session promise. Resolving a new session | 36 // Special class for resolving a new session promise. Resolving a new session |
| 37 // promise returns the session ID (as a string), but the blink promise needs | 37 // promise returns the session ID (as a string), but the blink promise needs |
| 38 // to get passed a SessionStatus. This class converts the session id to a | 38 // to get passed a SessionStatus. This class converts the session id to a |
| 39 // SessionStatus by calling |new_session_created_cb|. | 39 // SessionStatus by calling |new_session_created_cb|. |
| 40 class MEDIA_EXPORT NewSessionCdmResultPromise | 40 class MEDIA_BLINK_EXPORT NewSessionCdmResultPromise |
| 41 : public CdmPromiseTemplate<std::string> { | 41 : public CdmPromiseTemplate<std::string> { |
| 42 public: | 42 public: |
| 43 NewSessionCdmResultPromise( | 43 NewSessionCdmResultPromise( |
| 44 const blink::WebContentDecryptionModuleResult& result, | 44 const blink::WebContentDecryptionModuleResult& result, |
| 45 const std::string& uma_name, | 45 const std::string& uma_name, |
| 46 const SessionInitializedCB& new_session_created_cb); | 46 const SessionInitializedCB& new_session_created_cb); |
| 47 ~NewSessionCdmResultPromise() override; | 47 ~NewSessionCdmResultPromise() override; |
| 48 | 48 |
| 49 // CdmPromiseTemplate<T> implementation. | 49 // CdmPromiseTemplate<T> implementation. |
| 50 void resolve(const std::string& session_id) override; | 50 void resolve(const std::string& session_id) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 // Called on resolve() to convert the session ID into a SessionInitStatus to | 61 // Called on resolve() to convert the session ID into a SessionInitStatus to |
| 62 // be reported to blink. | 62 // be reported to blink. |
| 63 SessionInitializedCB new_session_created_cb_; | 63 SessionInitializedCB new_session_created_cb_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); | 65 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace media | 68 } // namespace media |
| 69 | 69 |
| 70 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ | 70 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ |
| OLD | NEW |