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

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

Issue 302573002: Add a Javascript wrapper around ServiceRegistry and expose it to WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render-view-shell
Patch Set: address comments Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/mojo_web_ui_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
11 * 11 *
12 * The simple object defined in this javascript file listens for 12 * The simple object defined in this javascript file listens for
13 * certain events on omnibox.html, sends (when appropriate) the 13 * certain events on omnibox.html, sends (when appropriate) the
14 * input text to C++ code to start the omnibox autcomplete controller 14 * input text to C++ code to start the omnibox autcomplete controller
15 * working, and listens from callbacks from the C++ code saying that 15 * working, and listens from callbacks from the C++ code saying that
16 * results are available. When results (possibly intermediate ones) 16 * results are available. When results (possibly intermediate ones)
17 * are available, the Javascript formats them and displays them. 17 * are available, the Javascript formats them and displays them.
18 */ 18 */
19 define('main', [ 19 define('main', [
20 'mojo/public/js/bindings/connection', 20 'mojo/public/js/bindings/connection',
21 'chrome/browser/ui/webui/omnibox/omnibox.mojom', 21 'chrome/browser/ui/webui/omnibox/omnibox.mojom',
22 ], function(connector, browser) { 22 'content/public/renderer/service_provider',
23 ], function(connector, browser, serviceProvider) {
23 'use strict'; 24 'use strict';
24 25
25 var connection; 26 var connection;
26 var page; 27 var page;
27 28
28 /** 29 /**
29 * Register our event handlers. 30 * Register our event handlers.
30 */ 31 */
31 function initialize() { 32 function initialize() {
32 $('omnibox-input-form').addEventListener( 33 $('omnibox-input-form').addEventListener(
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 426 }
426 427
427 OmniboxPageImpl.prototype = 428 OmniboxPageImpl.prototype =
428 Object.create(browser.OmniboxPageStub.prototype); 429 Object.create(browser.OmniboxPageStub.prototype);
429 430
430 OmniboxPageImpl.prototype.handleNewAutocompleteResult = function(result) { 431 OmniboxPageImpl.prototype.handleNewAutocompleteResult = function(result) {
431 progressiveAutocompleteResults.push(result); 432 progressiveAutocompleteResults.push(result);
432 refresh(); 433 refresh();
433 }; 434 };
434 435
435 return function(handle) { 436 return function() {
436 connection = new connector.Connection(handle, OmniboxPageImpl, 437 connection = new connector.Connection(
437 browser.OmniboxUIHandlerMojoProxy); 438 // TODO(sammc): Avoid using NAME_ directly.
439 serviceProvider.connectToService(
440 browser.OmniboxUIHandlerMojoProxy.NAME_),
441 OmniboxPageImpl,
442 browser.OmniboxUIHandlerMojoProxy);
438 }; 443 };
439 }); 444 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/mojo_web_ui_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698