summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_ice_error_event.cc
blob: 3f2b7f607121369c7b5d12ff60812cbbf9bea1cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2019 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.

#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_ice_error_event.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_ice_error_event_init.h"

namespace blink {

RTCPeerConnectionIceErrorEvent* RTCPeerConnectionIceErrorEvent::Create(
    const String& host_candidate,
    const String& url,
    int error_code,
    const String& txt) {
  DCHECK(error_code > 0 && error_code <= USHRT_MAX);
  return MakeGarbageCollected<RTCPeerConnectionIceErrorEvent>(
      host_candidate, url, static_cast<uint16_t>(error_code), txt);
}

RTCPeerConnectionIceErrorEvent* RTCPeerConnectionIceErrorEvent::Create(
    const AtomicString& type,
    const RTCPeerConnectionIceErrorEventInit* initializer) {
  return MakeGarbageCollected<RTCPeerConnectionIceErrorEvent>(type,
                                                              initializer);
}

RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent(
    const String& host_candidate,
    const String& url,
    uint16_t error_code,
    const String& error_text)
    : Event(event_type_names::kIcecandidateerror,
            Bubbles::kNo,
            Cancelable::kNo),
      host_candidate_(host_candidate),
      url_(url),
      error_code_(error_code),
      error_text_(error_text) {}

RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent(
    const AtomicString& type,
    const RTCPeerConnectionIceErrorEventInit* initializer)
    : Event(type, initializer),
      host_candidate_(initializer->hostCandidate()),
      url_(initializer->url()),
      error_code_(initializer->errorCode()),
      error_text_(initializer->statusText()) {}

RTCPeerConnectionIceErrorEvent::~RTCPeerConnectionIceErrorEvent() = default;

String RTCPeerConnectionIceErrorEvent::hostCandidate() const {
  return host_candidate_;
}

String RTCPeerConnectionIceErrorEvent::url() const {
  return url_;
}

uint16_t RTCPeerConnectionIceErrorEvent::errorCode() const {
  return error_code_;
}

String RTCPeerConnectionIceErrorEvent::errorText() const {
  return error_text_;
}

const AtomicString& RTCPeerConnectionIceErrorEvent::InterfaceName() const {
  return event_interface_names::kRTCPeerConnectionIceErrorEvent;
}

void RTCPeerConnectionIceErrorEvent::Trace(blink::Visitor* visitor) {
  Event::Trace(visitor);
}

}  // namespace blink