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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 _createContentIfNeeded: function() 64 _createContentIfNeeded: function()
65 { 65 {
66 if (this._container) 66 if (this._container)
67 return; 67 return;
68 68
69 this._container = this.element.createChild("div", "image"); 69 this._container = this.element.createChild("div", "image");
70 var imagePreviewElement = this._container.createChild("img", "resource-i mage-view"); 70 var imagePreviewElement = this._container.createChild("img", "resource-i mage-view");
71 imagePreviewElement.addEventListener("contextmenu", this._contextMenu.bi nd(this), true); 71 imagePreviewElement.addEventListener("contextmenu", this._contextMenu.bi nd(this), true);
72 WebInspector.Resource.populateImageSource(this._url, this._mimeType, thi s._contentProvider, imagePreviewElement); 72 WebInspector.Resource.populateImageSource(this._url, this._mimeType, thi s._contentProvider, imagePreviewElement);
73 73
74 this._contentProvider.requestContent(onContentAvailable.bind(this)); 74 this._contentProvider.requestContent().then(onContentAvailable.bind(this ));
75 75
76 /** 76 /**
77 * @param {?string} content 77 * @param {?string} content
78 * @this {WebInspector.ImageView} 78 * @this {WebInspector.ImageView}
79 */ 79 */
80 function onContentAvailable(content) 80 function onContentAvailable(content)
81 { 81 {
82 this._sizeLabel.setText(Number.bytesToString(this._base64ToSize(cont ent))); 82 this._sizeLabel.setText(Number.bytesToString(this._base64ToSize(cont ent)));
83 this._dimensionsLabel.setText(WebInspector.UIString("%d × %d", image PreviewElement.naturalWidth, imagePreviewElement.naturalHeight)); 83 this._dimensionsLabel.setText(WebInspector.UIString("%d × %d", image PreviewElement.naturalWidth, imagePreviewElement.naturalHeight));
84 } 84 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 InspectorFrontendHost.copyText(this._url); 121 InspectorFrontendHost.copyText(this._url);
122 }, 122 },
123 123
124 _openInNewTab: function() 124 _openInNewTab: function()
125 { 125 {
126 InspectorFrontendHost.openInNewTab(this._url); 126 InspectorFrontendHost.openInNewTab(this._url);
127 }, 127 },
128 128
129 __proto__: WebInspector.VBoxWithToolbarItems.prototype 129 __proto__: WebInspector.VBoxWithToolbarItems.prototype
130 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698