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

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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 * @param {!MessagePort} port 553 * @param {!MessagePort} port
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 contentEncoded = false;
564 if (contentProvider instanceof WebInspector.Resource)
565 contentEncoded = contentProvider.contentEncoded;
566 if (contentProvider instanceof WebInspector.NetworkRequest)
567 contentEncoded = contentProvider.contentEncoded;
563 var response = { 568 var response = {
564 encoding: (content === null) || contentProvider.contentType().is TextType() ? "" : "base64", 569 encoding: contentEncoded && content ? "base64" : "",
565 content: content 570 content: content
566 }; 571 };
567 this._dispatchCallback(message.requestId, port, response); 572 this._dispatchCallback(message.requestId, port, response);
568 } 573 }
569 574
570 contentProvider.requestContent(onContentAvailable.bind(this)); 575 contentProvider.requestContent(onContentAvailable.bind(this));
571 }, 576 },
572 577
573 _onGetRequestContent: function(message, port) 578 _onGetRequestContent: function(message, port)
574 { 579 {
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 { 1109 {
1105 if (WebInspector.extensionServer._overridePlatformExtensionAPIForTest) 1110 if (WebInspector.extensionServer._overridePlatformExtensionAPIForTest)
1106 window.buildPlatformExtensionAPI = WebInspector.extensionServer._overrid ePlatformExtensionAPIForTest; 1111 window.buildPlatformExtensionAPI = WebInspector.extensionServer._overrid ePlatformExtensionAPIForTest;
1107 WebInspector.extensionServer._addExtensions(extensions); 1112 WebInspector.extensionServer._addExtensions(extensions);
1108 } 1113 }
1109 1114
1110 WebInspector.setInspectedTabId = function(tabId) 1115 WebInspector.setInspectedTabId = function(tabId)
1111 { 1116 {
1112 WebInspector._inspectedTabId = tabId; 1117 WebInspector._inspectedTabId = tabId;
1113 } 1118 }
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