Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: mojo/public/bindings/js/connection.js

Issue 207503004: Mojo: add javascript bindings for request/response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: --similarity=20 Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+});

Powered by Google App Engine
This is Rietveld 408576698