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

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

Issue 652813005: DevTools: Extenstions: use request.contentEncoded for GetRequestContent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 */ 554 */
555 _getResourceContent: function(contentProvider, message, port) 555 _getResourceContent: function(contentProvider, message, port)
556 { 556 {
557 /** 557 /**
558 * @param {?string} content 558 * @param {?string} content
559 * @this {WebInspector.ExtensionServer} 559 * @this {WebInspector.ExtensionServer}
560 */ 560 */
561 function onContentAvailable(content) 561 function onContentAvailable(content)
562 { 562 {
563 var response = { 563 var response = {
564 encoding: (content === null) || contentProvider.contentType().is TextType() ? "" : "base64", 564 encoding: content && contentProvider.contentEncoded ? "base64" : "",
565 content: content 565 content: content
566 }; 566 };
567 this._dispatchCallback(message.requestId, port, response); 567 this._dispatchCallback(message.requestId, port, response);
568 } 568 }
569 569
570 contentProvider.requestContent(onContentAvailable.bind(this)); 570 contentProvider.requestContent(onContentAvailable.bind(this));
vsevik 2014/10/24 05:58:19 Resource here could actually be a UISourceCode, so
eustas 2014/10/24 11:15:57 Done.
571 }, 571 },
572 572
573 _onGetRequestContent: function(message, port) 573 _onGetRequestContent: function(message, port)
574 { 574 {
575 var request = this._requestById(message.id); 575 var request = this._requestById(message.id);
576 if (!request) 576 if (!request)
577 return this._status.E_NOTFOUND(message.id); 577 return this._status.E_NOTFOUND(message.id);
578 this._getResourceContent(request, message, port); 578 this._getResourceContent(request, message, port);
579 }, 579 },
580 580
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 { 1104 {
1105 if (WebInspector.extensionServer._overridePlatformExtensionAPIForTest) 1105 if (WebInspector.extensionServer._overridePlatformExtensionAPIForTest)
1106 window.buildPlatformExtensionAPI = WebInspector.extensionServer._overrid ePlatformExtensionAPIForTest; 1106 window.buildPlatformExtensionAPI = WebInspector.extensionServer._overrid ePlatformExtensionAPIForTest;
1107 WebInspector.extensionServer._addExtensions(extensions); 1107 WebInspector.extensionServer._addExtensions(extensions);
1108 } 1108 }
1109 1109
1110 WebInspector.setInspectedTabId = function(tabId) 1110 WebInspector.setInspectedTabId = function(tabId)
1111 { 1111 {
1112 WebInspector._inspectedTabId = tabId; 1112 WebInspector._inspectedTabId = tabId;
1113 } 1113 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698