Shaka Player Embedded
media_key_message_event.h
Go to the documentation of this file.
1 // Copyright 2017 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_JS_EVENTS_MEDIA_KEY_MESSAGE_EVENT_H_
16 #define SHAKA_EMBEDDED_JS_EVENTS_MEDIA_KEY_MESSAGE_EVENT_H_
17 
18 #include <memory>
19 #include <string>
20 #include <utility>
21 
22 #include "shaka/optional.h"
24 #include "src/js/events/event.h"
27 #include "src/mapping/struct.h"
28 
29 namespace shaka {
30 namespace js {
31 namespace events {
32 
35 
38 };
39 
40 
44 class MediaKeyMessageEvent final : public Event {
46 
47  public:
48  MediaKeyMessageEvent(EventType event_type,
49  eme::MediaKeyMessageType message_type,
51 
53  const std::string& event_type,
55  if (init_data.has_value()) {
56  return new MediaKeyMessageEvent(event_type, init_data->messageType,
57  std::move(init_data->message));
58  } else {
59  return new MediaKeyMessageEvent(
61  }
62  }
63 
64  void Trace(memory::HeapTracer* tracer) const override;
65 
68 
69  private:
70  MediaKeyMessageEvent(const std::string& event_type,
71  eme::MediaKeyMessageType message_type,
72  ByteBuffer message);
73 };
74 
76  : public BackingObjectFactory<MediaKeyMessageEvent, Event> {
77  public:
79 };
80 
81 } // namespace events
82 } // namespace js
83 } // namespace shaka
84 
85 #endif // SHAKA_EMBEDDED_JS_EVENTS_MEDIA_KEY_MESSAGE_EVENT_H_
static MediaKeyMessageEvent * Create(const std::string &event_type, optional< MediaKeyMessageEventInit > init_data)
ADD_DICT_FIELD(messageType, eme::MediaKeyMessageType)
const eme::MediaKeyMessageType message_type
DECLARE_STRUCT_SPECIAL_METHODS_MOVE_ONLY(MediaKeyMessageEventInit)
const char * message
void Trace(memory::HeapTracer *tracer) const override
Definition: struct.cc:49
#define DECLARE_TYPE_INFO(type)
bool has_value() const
Definition: optional.h:143