Commit 6b134dd1 authored by Alexander Surkov's avatar Alexander Surkov
Browse files

Bug 1521306 - Remove toolkit handler binding, r=bgrins

Differential Revision: https://phabricator.services.mozilla.com/D21773

--HG--
extra : moz-landing-system : lando
parent 81c9d98e
......@@ -32,6 +32,38 @@ const {EnableDelayHelper} = ChromeUtils.import("resource://gre/modules/SharedPro
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
class MozHandler extends window.MozElements.MozRichlistitem {
connectedCallback() {
this.textContent = "";
this.appendChild(window.MozXULElement.parseXULToFragment(`
<vbox pack="center">
<image height="32" width="32"/>
</vbox>
<vbox flex="1">
<label class="name"/>
<label class="description"/>
</vbox>
`));
this.initializeAttributeInheritance();
}
static get inheritedAttributes() {
return {
"image": "src=image,disabled",
".name": "value=name,disabled",
".description": "value=description,disabled",
};
}
get label() {
return `${this.getAttribute("name")} ${this.getAttribute("description")}`;
}
}
customElements.define("mozapps-handler", MozHandler, {
extends: "richlistitem",
});
var dialog = {
// Member Variables
......@@ -122,8 +154,7 @@ var dialog = {
var preferredHandler = this._handlerInfo.preferredApplicationHandler;
for (let i = possibleHandlers.length - 1; i >= 0; --i) {
let app = possibleHandlers.queryElementAt(i, Ci.nsIHandlerApp);
let elm = document.createElement("richlistitem");
elm.setAttribute("type", "handler");
let elm = document.createElement("richlistitem", {is: "mozapps-handler"});
elm.setAttribute("name", app.name);
elm.obj = app;
......@@ -171,8 +202,7 @@ var dialog = {
}
if (this._handlerInfo.hasDefaultHandler) {
let elm = document.createElement("richlistitem");
elm.setAttribute("type", "handler");
let elm = document.createElement("richlistitem", {is: "mozapps-handler"});
elm.id = "os-default-handler";
elm.setAttribute("name", this._handlerInfo.defaultDescription);
......@@ -203,8 +233,7 @@ var dialog = {
}
}
if (!appAlreadyInHandlers) {
let elm = document.createElement("richlistitem");
elm.setAttribute("type", "handler");
let elm = document.createElement("richlistitem", {is: "mozapps-handler"});
elm.setAttribute("name", handler.name);
elm.obj = handler;
items.insertBefore(elm, this._itemChoose);
......@@ -245,8 +274,7 @@ var dialog = {
}
}
let elm = document.createElement("richlistitem");
elm.setAttribute("type", "handler");
let elm = document.createElement("richlistitem", {is: "mozapps-handler"});
elm.setAttribute("name", fp.file.leafName);
elm.setAttribute("image", "moz-icon://" + uri.spec + "?size=32");
elm.obj = handlerApp;
......
......@@ -2,10 +2,6 @@
* 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/. */
richlistitem[type="handler"] {
-moz-binding: url('chrome://mozapps/content/handling/handler.xml#handler');
}
#remember-text:not([visible]) {
visibility: hidden;
}
<?xml version="1.0"?>
<!-- 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/. -->
<bindings id="hanlder-bindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="handler"
extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<content>
<xul:vbox pack="center">
<xul:image xbl:inherits="src=image,disabled" height="32" width="32"/>
</xul:vbox>
<xul:vbox flex="1">
<xul:label class="name" xbl:inherits="value=name,disabled"/>
<xul:label class="description" xbl:inherits="value=description,disabled"/>
</xul:vbox>
</content>
<implementation>
<property name="label" onget="return this.getAttribute('name') + ' ' + this.getAttribute('description');"/>
</implementation>
</binding>
</bindings>
......@@ -5,6 +5,5 @@
toolkit.jar:
% content mozapps %content/mozapps/
content/mozapps/handling/handler.css (content/handler.css)
content/mozapps/handling/handler.xml (content/handler.xml)
content/mozapps/handling/dialog.xul (content/dialog.xul)
content/mozapps/handling/dialog.js (content/dialog.js)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment