Backout a3f5b011f665 for Android bustage

This commit is contained in:
Brian Nicholson 2012-06-26 18:07:15 -07:00
Родитель 3e70cba3aa
Коммит b477ae7df7
4 изменённых файлов: 14 добавлений и 89 удалений

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

@ -1,60 +0,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/. */
"use strict";
var HelperApps = {
get defaultHttpHandlers() {
let protoHandlers = this.getAppsForProtocol("http");
var results = {};
for (var i = 0; i < protoHandlers.length; i++) {
try {
let protoApp = protoHandlers.queryElementAt(i, Ci.nsIHandlerApp);
results[protoApp.name] = protoApp;
} catch(e) {}
}
delete this.defaultHttpHandlers;
return this.defaultHttpHandlers = results;
},
get protoSvc() {
delete this.protoSvc;
return this.protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
},
get urlHandlerService() {
delete this.urlHandlerService;
return this.urlHandlerService = Cc["@mozilla.org/uriloader/external-url-handler-service;1"].getService(Ci.nsIExternalURLHandlerService);
},
getAppsForProtocol: function getAppsForProtocol(uri) {
let handlerInfoProto = this.protoSvc.getProtocolHandlerInfoFromOS(uri, {});
return handlerInfoProto.possibleApplicationHandlers;
},
getAppsForUri: function getAppsFor(uri) {
let found = [];
let handlerInfoProto = this.urlHandlerService.getURLHandlerInfoFromOS(uri, {});
let urlHandlers = handlerInfoProto.possibleApplicationHandlers;
for (var i = 0; i < urlHandlers.length; i++) {
let urlApp = urlHandlers.queryElementAt(i, Ci.nsIHandlerApp);
if (!this.defaultHttpHandlers[urlApp.name]) {
found.push(urlApp);
}
}
return found;
},
openUriInApp: function openUriInApp(uri) {
var possibleHandlers = this.getAppsForUri(uri);
if (possibleHandlers.length == 1) {
possibleHandlers[0].launchWithURI(uri);
} else if (possibleHandlers.length > 0) {
let handlerInfoProto = this.urlHandlerService.getURLHandlerInfoFromOS(uri, {});
handlerInfoProto.preferredApplicationHandler.launchWithURI(uri);
}
}
};

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

@ -29,7 +29,6 @@ XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() {
// Lazily-loaded browser scripts:
[
["HelperApps", "chrome://browser/content/HelperApps.js"],
["SelectHelper", "chrome://browser/content/SelectHelper.js"],
["Readability", "chrome://browser/content/Readability.js"],
].forEach(function (aScript) {
@ -1826,26 +1825,19 @@ var UserAgent = {
if (tab == null)
break;
let apps = HelperApps.getAppsForUri(channel.URI);
if (apps.length > 0) {
let message = apps.length == 1 ? Strings.browser.formatStringFromName("helperapps.openWithApp", [apps[0].name], 1) :
Strings.browser.GetStringFromName("helperapps.openWithList");
let buttons = [{
label: Strings.browser.GetStringFromName("helperapps.open"),
callback: function() {
aSubject.QueryInterface(Ci.nsIRequest).cancel(Components.results.NS_ERROR_ABORT);
HelperApps.openUriInApp(channel.URI);
}
},
{
label: Strings.browser.GetStringFromName("helperapps.cancel"),
callback: function() { }
}];
// Persist this over page loads. Pages that expect to open in helper apps often redirect
// Youtube redirects twice, so I've forced this to two for now
let options = { persistence: 2 };
let name = "helperapps-" + (apps.length > 1 ? "list" : apps[0].name);
NativeWindow.doorhanger.show(message, name, buttons, self.id, options);
// Send XUL UA to YouTube; temporary hack to make videos play
if (channel.URI.host.indexOf("youtube") != -1) {
let ua = Cc["@mozilla.org/network/protocol;1?name=http"].getService(Ci.nsIHttpProtocolHandler).userAgent;
#expand let version = "__MOZ_APP_VERSION__";
ua += " Fennec/" + version;
channel.setRequestHeader("User-Agent", ua, false);
}
// Send desktop UA if "Request Desktop Site" is enabled
if (tab.desktopMode && (channel.loadFlags & Ci.nsIChannel.LOAD_DOCUMENT_URI))
channel.setRequestHeader("User-Agent", this.DESKTOP_UA, false);
break;
}
}
}
@ -5051,7 +5043,7 @@ var PermissionsHelper = {
// If we implement a two-line UI, we will need to pass the label and
// value individually and let java handle the formatting
let setting = Strings.browser.formatStringFromName("siteSettings.labelToValue",
[ label, valueString ], 2);
[ label, valueString ], 2)
permissions.push({
type: type,
setting: setting

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

@ -36,7 +36,6 @@ chrome.jar:
* content/downloads.js (content/downloads.js)
content/netError.xhtml (content/netError.xhtml)
content/SelectHelper.js (content/SelectHelper.js)
content/HelperApps.js (content/HelperApps.js)
content/dbg-browser-actors.js (content/dbg-browser-actors.js)
% override chrome://global/content/config.xul chrome://browser/content/config.xhtml

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

@ -264,9 +264,3 @@ remoteIncomingPromptTitle=Incoming Connection
# dialog that prompts the user to allow the incoming connection.
remoteIncomingPromptMessage=An incoming request to permit remote debugging connection was detected. A remote client can take complete control over your browser! Allow connection?
remoteIncomingPromptDisable=Disable
# Helper apps
helperapps.openWithApp=The %S App can open this link.
helperapps.openWithList=You have apps installed that can open this link.
helperapps.open=Open with App
helperapps.cancel=Cancel