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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js

Issue 2516253002: [DevTools] Remove HandlerRegistry. (Closed)
Patch Set: rebase, fixed comments 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 Common.Revealer.reveal(request); 381 Common.Revealer.reveal(request);
382 return this._status.OK(); 382 return this._status.OK();
383 } 383 }
384 384
385 return this._status.E_NOTFOUND(message.url); 385 return this._status.E_NOTFOUND(message.url);
386 } 386 }
387 387
388 _onSetOpenResourceHandler(message, port) { 388 _onSetOpenResourceHandler(message, port) {
389 var name = this._registeredExtensions[port._extensionOrigin].name || ('Exten sion ' + port._extensionOrigin); 389 var name = this._registeredExtensions[port._extensionOrigin].name || ('Exten sion ' + port._extensionOrigin);
390 if (message.handlerPresent) 390 if (message.handlerPresent)
391 Components.openAnchorLocationRegistry.registerHandler(name, this._handleOp enURL.bind(this, port)); 391 Components.Linkifier.registerLinkHandler(name, this._handleOpenURL.bind(th is, port));
392 else 392 else
393 Components.openAnchorLocationRegistry.unregisterHandler(name); 393 Components.Linkifier.unregisterLinkHandler(name);
394 } 394 }
395 395
396 _handleOpenURL(port, details) { 396 _handleOpenURL(port, contentProvider, lineNumber) {
397 var url = /** @type {string} */ (details.url); 397 port.postMessage(
398 var contentProvider = Workspace.workspace.uiSourceCodeForURL(url) || Binding s.resourceForURL(url); 398 {command: 'open-resource', resource: this._makeResource(contentProvider) , lineNumber: lineNumber + 1});
399 if (!contentProvider)
400 return false;
401
402 var lineNumber = details.lineNumber;
403 if (typeof lineNumber === 'number')
404 lineNumber += 1;
405 port.postMessage({command: 'open-resource', resource: this._makeResource(con tentProvider), lineNumber: lineNumber});
406 return true;
407 } 399 }
408 400
409 _onReload(message) { 401 _onReload(message) {
410 var options = /** @type {!ExtensionReloadOptions} */ (message.options || {}) ; 402 var options = /** @type {!ExtensionReloadOptions} */ (message.options || {}) ;
411 403
412 SDK.multitargetNetworkManager.setUserAgentOverride(typeof options.userAgent === 'string' ? options.userAgent : ''); 404 SDK.multitargetNetworkManager.setUserAgentOverride(typeof options.userAgent === 'string' ? options.userAgent : '');
413 var injectedScript; 405 var injectedScript;
414 if (options.injectedScript) 406 if (options.injectedScript)
415 injectedScript = '(function(){' + options.injectedScript + '})()'; 407 injectedScript = '(function(){' + options.injectedScript + '})()';
416 SDK.targetManager.reloadPage(!!options.ignoreCache, injectedScript); 408 SDK.targetManager.reloadPage(!!options.ignoreCache, injectedScript);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 /** 1033 /**
1042 * @typedef {{code: string, description: string, details: !Array.<*>}} 1034 * @typedef {{code: string, description: string, details: !Array.<*>}}
1043 */ 1035 */
1044 Extensions.ExtensionStatus.Record; 1036 Extensions.ExtensionStatus.Record;
1045 1037
1046 Extensions.extensionAPI = {}; 1038 Extensions.extensionAPI = {};
1047 defineCommonExtensionSymbols(Extensions.extensionAPI); 1039 defineCommonExtensionSymbols(Extensions.extensionAPI);
1048 1040
1049 /** @type {!Extensions.ExtensionServer} */ 1041 /** @type {!Extensions.ExtensionServer} */
1050 Extensions.extensionServer; 1042 Extensions.extensionServer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698