Bug 896945 Customize the open-app treatment based on the showApp and showOnly flags r=alive r=fabrice

The Gecko patch on Bug 896945 *must* be checked in before checking in this one. For the most part applying Gecko patch without applying this one should be safe (not everything will work correctly, but most things will actually do) but the reverse isn't true.