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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js

Issue 2844383003: [DevTools] Move the rest of emulation to EmulationModel (Closed)
Patch Set: Created 3 years, 7 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 // 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 ctx.drawImage(image, rect.left, rect.top, rect.width, rect.height); 445 ctx.drawImage(image, rect.left, rect.top, rect.width, rect.height);
446 fulfill(); 446 fulfill();
447 }; 447 };
448 }); 448 });
449 } 449 }
450 450
451 /** 451 /**
452 * @param {!Element} canvas 452 * @param {!Element} canvas
453 */ 453 */
454 _saveScreenshot(canvas) { 454 _saveScreenshot(canvas) {
455 var url = this._model.target() && this._model.target().inspectedURL(); 455 var url = this._model.inspectedURL();
456 var fileName = url ? url.trimURL().removeURLFragment() : ''; 456 var fileName = url ? url.trimURL().removeURLFragment() : '';
457 if (this._model.type() === Emulation.DeviceModeModel.Type.Device) 457 if (this._model.type() === Emulation.DeviceModeModel.Type.Device)
458 fileName += Common.UIString('(%s)', this._model.device().title); 458 fileName += Common.UIString('(%s)', this._model.device().title);
459 var link = createElement('a'); 459 var link = createElement('a');
460 link.download = fileName + '.png'; 460 link.download = fileName + '.png';
461 canvas.toBlob(blob => { 461 canvas.toBlob(blob => {
462 link.href = URL.createObjectURL(blob); 462 link.href = URL.createObjectURL(blob);
463 link.click(); 463 link.click();
464 }); 464 });
465 } 465 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return Promise.resolve(); 558 return Promise.resolve();
559 } 559 }
560 560
561 /** 561 /**
562 * @param {number} size 562 * @param {number} size
563 */ 563 */
564 _onMarkerClick(size) { 564 _onMarkerClick(size) {
565 this._applyCallback.call(null, size); 565 this._applyCallback.call(null, size);
566 } 566 }
567 }; 567 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698