Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 */ | 8 */ |
| 9 WebInspector.DeviceModeView = function() | 9 WebInspector.DeviceModeView = function() |
| 10 { | 10 { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 */ | 465 */ |
| 466 function paintScreenshot() | 466 function paintScreenshot() |
| 467 { | 467 { |
| 468 var pageImage = new Image(); | 468 var pageImage = new Image(); |
| 469 pageImage.src = "data:image/png;base64," + content; | 469 pageImage.src = "data:image/png;base64," + content; |
| 470 ctx.drawImage(pageImage, | 470 ctx.drawImage(pageImage, |
| 471 visiblePageRect.left, | 471 visiblePageRect.left, |
| 472 visiblePageRect.top, | 472 visiblePageRect.top, |
| 473 Math.min(pageImage.naturalWidth, screenRect.width) , | 473 Math.min(pageImage.naturalWidth, screenRect.width) , |
| 474 Math.min(pageImage.naturalHeight, screenRect.heigh t)); | 474 Math.min(pageImage.naturalHeight, screenRect.heigh t)); |
| 475 var mainFrame = mainTarget.resourceTreeModel.mainFrame; | 475 var url = mainTarget && mainTarget.inspectedURL() |
|
dgozman
2016/08/20 01:32:00
style: missing semicolon
eostroukhov-old
2016/08/22 17:55:41
Done.
| |
| 476 var fileName = mainFrame ? mainFrame.url.trimURL().removeURLFrag ment() : ""; | 476 var fileName = url ? url.trimURL().removeURLFragment() : ""; |
| 477 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice) | 477 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice) |
| 478 fileName += WebInspector.UIString("(%s)", this._model.device ().title); | 478 fileName += WebInspector.UIString("(%s)", this._model.device ().title); |
| 479 // Trigger download. | 479 // Trigger download. |
| 480 var link = createElement("a"); | 480 var link = createElement("a"); |
| 481 link.download = fileName + ".png"; | 481 link.download = fileName + ".png"; |
| 482 link.href = canvas.toDataURL("image/png"); | 482 link.href = canvas.toDataURL("image/png"); |
| 483 link.click(); | 483 link.click(); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 }, | 486 }, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 /** | 586 /** |
| 587 * @param {number} size | 587 * @param {number} size |
| 588 */ | 588 */ |
| 589 _onMarkerClick: function(size) | 589 _onMarkerClick: function(size) |
| 590 { | 590 { |
| 591 this._applyCallback.call(null, size); | 591 this._applyCallback.call(null, size); |
| 592 }, | 592 }, |
| 593 | 593 |
| 594 __proto__: WebInspector.VBox.prototype | 594 __proto__: WebInspector.VBox.prototype |
| 595 } | 595 } |
| OLD | NEW |