Index: public/platform/WebRTCCertificate.h |
diff --git a/public/platform/WebRTCCertificate.h b/public/platform/WebRTCCertificate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bac1ef27181fe50868de17aae2fa43bf5ca5edd2 |
--- /dev/null |
+++ b/public/platform/WebRTCCertificate.h |
@@ -0,0 +1,85 @@ |
+/* |
+ * Copyright (C) 2015 Google Inc. All rights reserved. |
+ * |
+ * Redistribution and use in source and binary forms, with or without |
+ * modification, are permitted provided that the following conditions are |
+ * met: |
+ * |
+ * * Redistributions of source code must retain the above copyright |
+ * notice, this list of conditions and the following disclaimer. |
+ * * Redistributions in binary form must reproduce the above |
+ * copyright notice, this list of conditions and the following disclaimer |
+ * in the documentation and/or other materials provided with the |
+ * distribution. |
+ * * Neither the name of Google Inc. nor the names of its |
+ * contributors may be used to endorse or promote products derived from |
+ * this software without specific prior written permission. |
+ * |
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ */ |
+ |
+#ifndef WebRTCCertificate_h |
+#define WebRTCCertificate_h |
+ |
+#include "public/platform/WebURL.h" |
+ |
+namespace blink { |
+ |
+// Interface defining what blink needs to know about certificates (abstracting away |
+// Chrome and WebRTC layer implementation details). You can create shallow copies of the |
+// WebRTCCertificate. When all copies are destroyed, the implementation-specific data must |
+// be freed. |
+class WebRTCCertificate { |
+public: |
+ WebRTCCertificate() { } |
Guido Urdaneta
2015/09/03 11:07:49
You don't need this constructor.
hbos_chromium
2015/09/03 16:01:37
Actually because I've defined other constructors (
|
+ virtual ~WebRTCCertificate() { } |
Guido Urdaneta
2015/09/03 11:07:49
= default is preferred.
hbos_chromium
2015/09/03 16:01:37
Done.
|
+ WebRTCCertificate(const WebRTCCertificate&) = delete; |
+ WebRTCCertificate& operator=(const WebRTCCertificate&) = delete; |
Guido Urdaneta
2015/09/03 11:07:49
To prevent copying you can use WTF_MAKE_NONCOPYABL
hbos_chromium
2015/09/03 16:01:37
Ok. I'll use it and see if anyone complains.
|
+ |
+ // Copies the WebRTCCertificate object without copying the underlying |
+ // implementation-specific (WebRTC layer) certificate. When all copies are destroyed |
+ // the underlying data is freed. |
+ virtual WebRTCCertificate* shallowCopy() const = 0; |
+ |
+ virtual double expires() const = 0; |
+}; |
+ |
+// Interface defining a callback function for use in WebRTCCertificateGenerator's |
+// asynchronous certificate generation. |
+class WebRTCCertificateObserver { |
Guido Urdaneta
2015/09/03 11:07:49
What about using the generic WebCallbacks?
hbos_chromium
2015/09/03 16:01:37
Done.
|
+public: |
+ virtual ~WebRTCCertificateObserver() { } |
+ |
+ // Called when WebRTCCertificateGenerator completes the generateCertificate request. |
+ // On success, |certificate| != null. The ownership is passed to this function. |
+ // On failure, |certificate| == null. |
+ virtual void onGenerateComplete(WebRTCCertificate* /*certificate*/) = 0; |
+}; |
+ |
+// Interface defining a class that can generate WebRTCCertificates asynchronously. |
+class WebRTCCertificateGenerator { |
+public: |
+ virtual ~WebRTCCertificateGenerator() { } |
+ |
+ // Start generating a certificate. The observer's onGenerateComplete is called when |
+ // the asynchronous operation finished (whether or not successful). |
+ virtual void generateCertificate( |
+ int keyType, |
+ const WebURL& /*url*/, |
+ const WebURL& /*firstPartyForCookies*/, |
+ WebRTCCertificateObserver*) = 0; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // WebRTCCertificate_h |