| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // promise returns the session ID (as a string), but the blink promise needs | 22 // promise returns the session ID (as a string), but the blink promise needs |
| 23 // to get passed a SessionStatus. This class converts the session id to a | 23 // to get passed a SessionStatus. This class converts the session id to a |
| 24 // SessionStatus by calling |new_session_created_cb|. | 24 // SessionStatus by calling |new_session_created_cb|. |
| 25 class MEDIA_EXPORT NewSessionCdmResultPromise | 25 class MEDIA_EXPORT NewSessionCdmResultPromise |
| 26 : public CdmPromiseTemplate<std::string> { | 26 : public CdmPromiseTemplate<std::string> { |
| 27 public: | 27 public: |
| 28 NewSessionCdmResultPromise( | 28 NewSessionCdmResultPromise( |
| 29 const blink::WebContentDecryptionModuleResult& result, | 29 const blink::WebContentDecryptionModuleResult& result, |
| 30 const std::string& uma_name, | 30 const std::string& uma_name, |
| 31 const SessionInitializedCB& new_session_created_cb); | 31 const SessionInitializedCB& new_session_created_cb); |
| 32 virtual ~NewSessionCdmResultPromise(); | 32 ~NewSessionCdmResultPromise() override; |
| 33 | 33 |
| 34 // CdmPromiseTemplate<T> implementation. | 34 // CdmPromiseTemplate<T> implementation. |
| 35 virtual void resolve(const std::string& web_session_id) override; | 35 void resolve(const std::string& web_session_id) override; |
| 36 virtual void reject(MediaKeys::Exception exception_code, | 36 void reject(MediaKeys::Exception exception_code, |
| 37 uint32 system_code, | 37 uint32 system_code, |
| 38 const std::string& error_message) override; | 38 const std::string& error_message) override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 blink::WebContentDecryptionModuleResult web_cdm_result_; | 41 blink::WebContentDecryptionModuleResult web_cdm_result_; |
| 42 | 42 |
| 43 // UMA name to report result to. | 43 // UMA name to report result to. |
| 44 std::string uma_name_; | 44 std::string uma_name_; |
| 45 | 45 |
| 46 // Called on resolve() to convert the session ID into a SessionStatus to | 46 // Called on resolve() to convert the session ID into a SessionStatus to |
| 47 // be reported to blink. | 47 // be reported to blink. |
| 48 SessionInitializedCB new_session_created_cb_; | 48 SessionInitializedCB new_session_created_cb_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); | 50 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace media | 53 } // namespace media |
| 54 | 54 |
| 55 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ | 55 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ |
| OLD | NEW |