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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Emulation.DeviceModeView = class extends UI.VBox { | 7 Emulation.DeviceModeView = class extends UI.VBox { |
8 constructor() { | 8 constructor() { |
9 super(true); | 9 super(true); |
10 this.setMinimumSize(150, 150); | 10 this.setMinimumSize(150, 150); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 var rect = this._contentArea.getBoundingClientRect(); | 369 var rect = this._contentArea.getBoundingClientRect(); |
370 var availableSize = new Size(Math.max(rect.width * zoomFactor, 1), Math.max(
rect.height * zoomFactor, 1)); | 370 var availableSize = new Size(Math.max(rect.width * zoomFactor, 1), Math.max(
rect.height * zoomFactor, 1)); |
371 var outlineVisible = this._model.deviceOutlineSetting().get(); | 371 var outlineVisible = this._model.deviceOutlineSetting().get(); |
372 | 372 |
373 if (availableSize.width < this._model.screenRect().width || | 373 if (availableSize.width < this._model.screenRect().width || |
374 availableSize.height < this._model.screenRect().height) { | 374 availableSize.height < this._model.screenRect().height) { |
375 UI.inspectorView.minimize(); | 375 UI.inspectorView.minimize(); |
376 this._model.deviceOutlineSetting().set(false); | 376 this._model.deviceOutlineSetting().set(false); |
377 } | 377 } |
378 | 378 |
379 mainTarget.pageAgent().captureScreenshot(screenshotCaptured.bind(this)); | 379 mainTarget.pageAgent().captureScreenshot('png', 100, screenshotCaptured.bind
(this)); |
380 | 380 |
381 /** | 381 /** |
382 * @param {?Protocol.Error} error | 382 * @param {?Protocol.Error} error |
383 * @param {string} content | 383 * @param {string} content |
384 * @this {Emulation.DeviceModeView} | 384 * @this {Emulation.DeviceModeView} |
385 */ | 385 */ |
386 function screenshotCaptured(error, content) { | 386 function screenshotCaptured(error, content) { |
387 this._model.deviceOutlineSetting().set(outlineVisible); | 387 this._model.deviceOutlineSetting().set(outlineVisible); |
388 var dpr = window.devicePixelRatio; | 388 var dpr = window.devicePixelRatio; |
389 var outlineRect = this._model.outlineRect().scale(dpr); | 389 var outlineRect = this._model.outlineRect().scale(dpr); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 return Promise.resolve(); | 563 return Promise.resolve(); |
564 } | 564 } |
565 | 565 |
566 /** | 566 /** |
567 * @param {number} size | 567 * @param {number} size |
568 */ | 568 */ |
569 _onMarkerClick(size) { | 569 _onMarkerClick(size) { |
570 this._applyCallback.call(null, size); | 570 this._applyCallback.call(null, size); |
571 } | 571 } |
572 }; | 572 }; |
OLD | NEW |