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 resourceTreeModel = mainTarget && WebInspector.ResourceTreeM odel.fromTarget(mainTarget); |
| 476 var mainFrame = resourceTreeModel && resourceTreeModel.mainFrame ; | |
| 476 var fileName = mainFrame ? mainFrame.url.trimURL().removeURLFrag ment() : ""; | 477 var fileName = mainFrame ? mainFrame.url.trimURL().removeURLFrag ment() : ""; |
|
dgozman
2016/08/19 20:23:37
All this code looks like WI.targetManager.inspecte
eostroukhov
2016/08/20 01:22:30
Done.
| |
| 477 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice) | 478 if (this._model.type() === WebInspector.DeviceModeModel.Type.Dev ice) |
| 478 fileName += WebInspector.UIString("(%s)", this._model.device ().title); | 479 fileName += WebInspector.UIString("(%s)", this._model.device ().title); |
| 479 // Trigger download. | 480 // Trigger download. |
| 480 var link = createElement("a"); | 481 var link = createElement("a"); |
| 481 link.download = fileName + ".png"; | 482 link.download = fileName + ".png"; |
| 482 link.href = canvas.toDataURL("image/png"); | 483 link.href = canvas.toDataURL("image/png"); |
| 483 link.click(); | 484 link.click(); |
| 484 } | 485 } |
| 485 } | 486 } |
| 486 }, | 487 }, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 /** | 587 /** |
| 587 * @param {number} size | 588 * @param {number} size |
| 588 */ | 589 */ |
| 589 _onMarkerClick: function(size) | 590 _onMarkerClick: function(size) |
| 590 { | 591 { |
| 591 this._applyCallback.call(null, size); | 592 this._applyCallback.call(null, size); |
| 592 }, | 593 }, |
| 593 | 594 |
| 594 __proto__: WebInspector.VBox.prototype | 595 __proto__: WebInspector.VBox.prototype |
| 595 } | 596 } |
| OLD | NEW |