Index: mojo/public/bindings/js/connection.js |
diff --git a/ui/keyboard/resources/elements/kb-key-import.js b/mojo/public/bindings/js/connection.js |
similarity index 23% |
copy from ui/keyboard/resources/elements/kb-key-import.js |
copy to mojo/public/bindings/js/connection.js |
index a06774ca95d790f34be7bba05e43d118bfcc6935..b422356d2a49c250e6dee14ccf68d3f031300040 100644 |
--- a/ui/keyboard/resources/elements/kb-key-import.js |
+++ b/mojo/public/bindings/js/connection.js |
@@ -2,21 +2,25 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-Polymer('kb-key-import', { |
- /** |
- * The id of the document fragment that will be imported. |
- */ |
- importId: null, |
+define("mojo/public/bindings/js/connection", [ |
+ "mojo/public/bindings/js/router", |
+], function(router) { |
- /** |
- * Import content from a document fragment. |
- * @param {!DocumentFragment} content Document fragment that contains |
- * the content to import. |
- */ |
- importDoc: function(content) { |
- var id = this.getAttribute('importId'); |
- var fragment = content.querySelector('#' + id); |
- return fragment && fragment.content ? fragment.content : fragment; |
+ 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; |
+ }; |
+ |
+ var exports = {}; |
+ exports.Connection = Connection; |
+ return exports; |
+}); |