Index: components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/RTCConfiguration.java |
diff --git a/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/RTCConfiguration.java b/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/RTCConfiguration.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bb2dbb039979982e9cff272051931a5cda2a5ed2 |
--- /dev/null |
+++ b/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/RTCConfiguration.java |
@@ -0,0 +1,62 @@ |
+// Copyright 2014 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. |
+ |
+package org.chromium.components.devtools_bridge; |
+ |
+import java.util.ArrayList; |
+import java.util.Collections; |
+import java.util.List; |
+ |
+/** |
+ * Represents RTCConfiguration (http://www.w3.org/TR/webrtc/#rtcconfiguration-type). |
+ * Replacement for List<PeerConnection.IceServer> in Java WebRTC API. |
+ * Transferable through signaling channel. |
+ * Immutable. |
+ */ |
+public class RTCConfiguration { |
+ /** |
+ * Single ICE server description. |
+ */ |
+ public static class IceServer { |
+ public final String uri; |
+ public final String username; |
+ public final String credential; |
+ |
+ public IceServer(String uri, String username, String credential) { |
+ this.uri = uri; |
+ this.username = username; |
+ this.credential = credential; |
+ } |
+ } |
+ |
+ public final List<IceServer> iceServers; |
+ |
+ private RTCConfiguration(List<IceServer> iceServers) { |
+ this.iceServers = Collections.unmodifiableList(new ArrayList<IceServer>(iceServers)); |
+ } |
+ |
+ public RTCConfiguration() { |
+ this(Collections.<IceServer>emptyList()); |
+ } |
+ |
+ /** |
+ * Builder for RTCConfiguration. |
+ */ |
+ public static class Builder { |
+ private final List<IceServer> mIceServers = new ArrayList<IceServer>(); |
+ |
+ public RTCConfiguration build() { |
+ return new RTCConfiguration(mIceServers); |
+ } |
+ |
+ public Builder addIceServer(String uri, String username, String credential) { |
+ mIceServers.add(new IceServer(uri, username, credential)); |
+ return this; |
+ } |
+ |
+ public Builder addIceServer(String uri) { |
+ return addIceServer(uri, "", ""); |
+ } |
+ } |
+} |