summaryrefslogtreecommitdiffstats
path: root/chromium/mojo/public/js/bindings/connection.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/mojo/public/js/bindings/connection.js')
-rw-r--r--chromium/mojo/public/js/bindings/connection.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/chromium/mojo/public/js/bindings/connection.js b/chromium/mojo/public/js/bindings/connection.js
new file mode 100644
index 00000000000..ebf60adb7f8
--- /dev/null
+++ b/chromium/mojo/public/js/bindings/connection.js
@@ -0,0 +1,30 @@
+// 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.
+
+define("mojo/public/js/bindings/connection", [
+ "mojo/public/js/bindings/router",
+], function(router) {
+
+ function Connection(handle, localFactory, remoteFactory) {
+ this.router_ = new router.Router(handle);
+ this.remote = new remoteFactory(this.router_);
+ this.local = new localFactory(this.remote);
+ this.router_.setIncomingReceiver(this.local);
+ }
+
+ Connection.prototype.close = function() {
+ this.router_.close();
+ this.router_ = null;
+ this.local = null;
+ this.remote = null;
+ };
+
+ Connection.prototype.encounteredError = function() {
+ return this.router_.encounteredError();
+ };
+
+ var exports = {};
+ exports.Connection = Connection;
+ return exports;
+});