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

Side by Side Diff: chrome/browser/resources/omnibox/omnibox.js

Issue 2590393002: Revert of Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Javascript for omnibox.html, served from chrome://omnibox/ 6 * Javascript for omnibox.html, served from chrome://omnibox/
7 * This is used to debug omnibox ranking. The user enters some text 7 * This is used to debug omnibox ranking. The user enters some text
8 * into a box, submits it, and then sees lots of debug information 8 * into a box, submits it, and then sees lots of debug information
9 * from the autocompleter that shows what omnibox would do with that 9 * from the autocompleter that shows what omnibox would do with that
10 * input. 10 * input.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 // NOTE: Need to keep a global reference to the |pageImpl| such that it is not 410 // NOTE: Need to keep a global reference to the |pageImpl| such that it is not
411 // garbage collected, which causes the pipe to close and future calls from C++ 411 // garbage collected, which causes the pipe to close and future calls from C++
412 // to JS to get dropped. 412 // to JS to get dropped.
413 var pageImpl = null; 413 var pageImpl = null;
414 var browserProxy = null; 414 var browserProxy = null;
415 415
416 function initializeProxies() { 416 function initializeProxies() {
417 return importModules([ 417 return importModules([
418 'mojo/public/js/bindings', 418 'mojo/public/js/bindings',
419 'mojo/public/js/connection',
419 'chrome/browser/ui/webui/omnibox/omnibox.mojom', 420 'chrome/browser/ui/webui/omnibox/omnibox.mojom',
420 'content/public/renderer/frame_interfaces', 421 'content/public/renderer/frame_interfaces',
421 ]).then(function(modules) { 422 ]).then(function(modules) {
422 var bindings = modules[0]; 423 var bindings = modules[0];
423 var mojom = modules[1]; 424 var connection = modules[1];
424 var frameInterfaces = modules[2]; 425 var mojom = modules[2];
426 var frameInterfaces = modules[3];
425 427
426 browserProxy = new mojom.OmniboxPageHandlerPtr( 428 browserProxy = connection.bindHandleToProxy(
427 frameInterfaces.getInterface(mojom.OmniboxPageHandler.name)); 429 frameInterfaces.getInterface(mojom.OmniboxPageHandler.name),
430 mojom.OmniboxPageHandler);
428 431
429 /** @constructor */ 432 /** @constructor */
430 var OmniboxPageImpl = function() { 433 var OmniboxPageImpl = function() {
431 this.binding = new bindings.Binding(mojom.OmniboxPage, this); 434 this.binding = new bindings.Binding(mojom.OmniboxPage, this);
432 }; 435 };
433 436
434 OmniboxPageImpl.prototype = { 437 OmniboxPageImpl.prototype = {
435 /** @override */ 438 /** @override */
436 handleNewAutocompleteResult: function(result) { 439 handleNewAutocompleteResult: function(result) {
437 progressiveAutocompleteResults.push(result); 440 progressiveAutocompleteResults.push(result);
438 refresh(); 441 refresh();
439 }, 442 },
440 }; 443 };
441 444
442 pageImpl = new OmniboxPageImpl(); 445 pageImpl = new OmniboxPageImpl();
443 browserProxy.setClientPage(pageImpl.binding.createInterfacePtrAndBind()); 446 browserProxy.setClientPage(pageImpl.binding.createInterfacePtrAndBind());
444 }); 447 });
445 } 448 }
446 449
447 document.addEventListener('DOMContentLoaded', function() { 450 document.addEventListener('DOMContentLoaded', function() {
448 return initializeProxies().then(function() { 451 return initializeProxies().then(function() {
449 initialize(); 452 initialize();
450 }); 453 });
451 }); 454 });
452 })(); 455 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/engagement/site_engagement.js ('k') | chrome/browser/resources/plugins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698