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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
| 12 #include "base/callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "media/base/cdm_promise.h" | 14 #include "media/base/cdm_promise.h" |
14 #include "media/base/media_keys.h" | |
15 #include "media/blink/media_blink_export.h" | 15 #include "media/blink/media_blink_export.h" |
16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 enum class SessionInitStatus { | 20 enum class SessionInitStatus { |
21 // Error creating the session. | 21 // Error creating the session. |
22 UNKNOWN_STATUS, | 22 UNKNOWN_STATUS, |
23 | 23 |
24 // New session has been initialized. | 24 // New session has been initialized. |
(...skipping 18 matching lines...) Expand all Loading... |
43 : public CdmPromiseTemplate<std::string> { | 43 : public CdmPromiseTemplate<std::string> { |
44 public: | 44 public: |
45 NewSessionCdmResultPromise( | 45 NewSessionCdmResultPromise( |
46 const blink::WebContentDecryptionModuleResult& result, | 46 const blink::WebContentDecryptionModuleResult& result, |
47 const std::string& uma_name, | 47 const std::string& uma_name, |
48 const SessionInitializedCB& new_session_created_cb); | 48 const SessionInitializedCB& new_session_created_cb); |
49 ~NewSessionCdmResultPromise() override; | 49 ~NewSessionCdmResultPromise() override; |
50 | 50 |
51 // CdmPromiseTemplate<T> implementation. | 51 // CdmPromiseTemplate<T> implementation. |
52 void resolve(const std::string& session_id) override; | 52 void resolve(const std::string& session_id) override; |
53 void reject(MediaKeys::Exception exception_code, | 53 void reject(CdmPromise::Exception exception_code, |
54 uint32_t system_code, | 54 uint32_t system_code, |
55 const std::string& error_message) override; | 55 const std::string& error_message) override; |
56 | 56 |
57 private: | 57 private: |
58 blink::WebContentDecryptionModuleResult web_cdm_result_; | 58 blink::WebContentDecryptionModuleResult web_cdm_result_; |
59 | 59 |
60 // UMA name to report result to. | 60 // UMA name to report result to. |
61 std::string uma_name_; | 61 std::string uma_name_; |
62 | 62 |
63 // Called on resolve() to convert the session ID into a SessionInitStatus to | 63 // Called on resolve() to convert the session ID into a SessionInitStatus to |
64 // be reported to blink. | 64 // be reported to blink. |
65 SessionInitializedCB new_session_created_cb_; | 65 SessionInitializedCB new_session_created_cb_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); | 67 DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace media | 70 } // namespace media |
71 | 71 |
72 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ | 72 #endif // MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_ |
OLD | NEW |