Bug 933201 - App manager moved screenshot button. r=paul.rouget

This commit is contained in:
Marvin Sevilla 2014-01-30 13:06:49 -05:00
Родитель 4544f4e7c7
Коммит 900be16dee
4 изменённых файлов: 20 добавлений и 18 удалений

Просмотреть файл

@ -13,6 +13,7 @@ const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools; const {require} = devtools;
const {ConnectionManager, Connection} = require("devtools/client/connection-manager"); const {ConnectionManager, Connection} = require("devtools/client/connection-manager");
const {getDeviceFront} = require("devtools/server/actors/device");
const ConnectionStore = require("devtools/app-manager/connection-store"); const ConnectionStore = require("devtools/app-manager/connection-store");
const DeviceStore = require("devtools/app-manager/device-store"); const DeviceStore = require("devtools/app-manager/device-store");
const simulatorsStore = require("devtools/app-manager/simulators-store"); const simulatorsStore = require("devtools/app-manager/simulators-store");
@ -187,4 +188,22 @@ let UI = {
this.connect(); this.connect();
}); });
}, },
screenshot: function() {
this.connection.client.listTabs(
response => {
let front = getDeviceFront(this.connection.client, response);
front.screenshotToBlob().then(blob => {
let topWindow = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = topWindow.gBrowser;
let url = topWindow.URL.createObjectURL(blob);
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
tab.addEventListener("TabClose", function onTabClose() {
tab.removeEventListener("TabClose", onTabClose, false);
topWindow.URL.revokeObjectURL(url);
}, false);
}).then(null, console.error);
}
);
},
} }

Просмотреть файл

@ -26,6 +26,7 @@
<div class="banner-content"> <div class="banner-content">
<span template='{"type":"localizedContent","property":"connection.connectedToDevice","paths":["device.description.name"]}'></span> <span template='{"type":"localizedContent","property":"connection.connectedToDevice","paths":["device.description.name"]}'></span>
<button class="action-cancel" onclick="UI.disconnect()" title="&connection.disconnectTooltip;">&connection.disconnect;</button> <button class="action-cancel" onclick="UI.disconnect()" title="&connection.disconnectTooltip;">&connection.disconnect;</button>
<button class="action-primary" onclick="UI.screenshot()" title="&device.screenshotTooltip;">&device.screenshot;</button>
</div> </div>
</div> </div>
</div> </div>

Просмотреть файл

@ -141,23 +141,6 @@ let UI = {
if (panel) panel.classList.add("selected"); if (panel) panel.classList.add("selected");
}, },
screenshot: function() {
if (!this.connected) {
return;
}
let front = getDeviceFront(this.connection.client, this.listTabsResponse);
front.screenshotToBlob().then(blob => {
let topWindow = Services.wm.getMostRecentWindow("navigator:browser");
let gBrowser = topWindow.gBrowser;
let url = topWindow.URL.createObjectURL(blob);
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
tab.addEventListener("TabClose", function onTabClose() {
tab.removeEventListener("TabClose", onTabClose, false);
topWindow.URL.revokeObjectURL(url);
}, false);
}).then(null, console.error);
},
openToolbox: function(manifest) { openToolbox: function(manifest) {
if (!this.connected) { if (!this.connected) {
return; return;

Просмотреть файл

@ -36,7 +36,6 @@
</h3> </h3>
<p template='{"type":"localizedContent","property":"device.deviceSize", "paths":["device.description.width","device.description.height","device.description.dpi"]}'></p> <p template='{"type":"localizedContent","property":"device.deviceSize", "paths":["device.description.width","device.description.height","device.description.dpi"]}'></p>
</header> </header>
<button onclick="UI.screenshot()" title="&device.screenshotTooltip;">&device.screenshot;</button>
<div id="tabs-headers"> <div id="tabs-headers">
<div onclick="UI.setTab('apps')" class="tab sidebar-item apps" title="&device.installedAppsTooltip;">&device.installedApps;</div> <div onclick="UI.setTab('apps')" class="tab sidebar-item apps" title="&device.installedAppsTooltip;">&device.installedApps;</div>
<div onclick="UI.setTab('permissions')" class="tab sidebar-item permissions" title="&device.permissionsTooltip;"> <div onclick="UI.setTab('permissions')" class="tab sidebar-item permissions" title="&device.permissionsTooltip;">