summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/media/rtc_certificate.cc
blob: 40d00ede555ac9714cf6aae739006aa91e544750 (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
// Copyright (c) 2015 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 "content/renderer/media/rtc_certificate.h"

#include "base/memory/ptr_util.h"
#include "url/gurl.h"

namespace content {

RTCCertificate::RTCCertificate(
    const rtc::scoped_refptr<rtc::RTCCertificate>& certificate)
    : certificate_(certificate) {
  DCHECK(certificate_);
}

RTCCertificate::~RTCCertificate() {
}

std::unique_ptr<blink::WebRTCCertificate> RTCCertificate::ShallowCopy() const {
  return base::WrapUnique(new RTCCertificate(certificate_));
}

uint64_t RTCCertificate::Expires() const {
  return certificate_->Expires();
}

blink::WebRTCCertificatePEM RTCCertificate::ToPEM() const {
  rtc::RTCCertificatePEM pem = certificate_->ToPEM();
  return blink::WebRTCCertificatePEM(
      blink::WebString::FromUTF8(pem.private_key()),
      blink::WebString::FromUTF8(pem.certificate()));
}

bool RTCCertificate::Equals(const blink::WebRTCCertificate& other) const {
  return *certificate_ ==
         *static_cast<const RTCCertificate&>(other).certificate_;
}

const rtc::scoped_refptr<rtc::RTCCertificate>&
RTCCertificate::rtcCertificate() const {
  return certificate_;
}

}  // namespace content