mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
a8478fc575
nsISettingsService isn't implemented, and hasn't been for some time. This patch removes its use, and removes all the code that depends on its presence, including getSetting() and getWallpaper(). --HG-- extra : rebase_source : e718bd5daf03179d42f42e00a55e0bebe3a03a2d
40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const Services = require("Services");
|
|
const protocol = require("devtools/shared/protocol");
|
|
const {LongStringActor} = require("devtools/server/actors/string");
|
|
const {DebuggerServer} = require("devtools/server/main");
|
|
const {getSystemInfo} = require("devtools/shared/system");
|
|
const {deviceSpec} = require("devtools/shared/specs/device");
|
|
|
|
exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, {
|
|
_desc: null,
|
|
|
|
getDescription: function() {
|
|
return getSystemInfo();
|
|
},
|
|
|
|
screenshotToDataURL: function() {
|
|
const window = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
|
|
const { devicePixelRatio } = window;
|
|
const canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
|
const width = window.innerWidth;
|
|
const height = window.innerHeight;
|
|
canvas.setAttribute("width", Math.round(width * devicePixelRatio));
|
|
canvas.setAttribute("height", Math.round(height * devicePixelRatio));
|
|
const context = canvas.getContext("2d");
|
|
const flags =
|
|
context.DRAWWINDOW_DRAW_CARET |
|
|
context.DRAWWINDOW_DRAW_VIEW |
|
|
context.DRAWWINDOW_USE_WIDGET_LAYERS;
|
|
context.scale(devicePixelRatio, devicePixelRatio);
|
|
context.drawWindow(window, 0, 0, width, height, "rgb(255,255,255)", flags);
|
|
const dataURL = canvas.toDataURL("image/png");
|
|
return new LongStringActor(this.conn, dataURL);
|
|
}
|
|
});
|