OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |