mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1253647 - Part 1 - Don't show page URL title on add-on restart doorhanger. r=sebastian
When a non-restartless add-on is (un)installed or updated, we show a doorhanger prompting the user to restart. Currently, the doorhanger's title is using the default logic for choosing its title, that is using the base domain of the tab the doorhanger is being displayed on. By chance, when the doorhanger is triggered from about:addons there is no domain to display, so the doorhanger is just displaying the restart notification. If however an add-on is automatically updated while the user is browsing, then the restart prompt will show the domain of the currently open tab in conjunction with the restart message. This can be confusing for the user, as it looks like it was in fact the current page that triggered the restart prompt. Therefore, we change this behaviour and just show a generic "Add-ons" as title for this case. MozReview-Commit-ID: 3pMwSiLul99 --HG-- extra : rebase_source : 3c11fe19c5cef42226a849b78d554fa846114bfa
This commit is contained in:
parent
5c67890d3a
commit
cd5c783e09
@ -19,6 +19,8 @@ import org.mozilla.gecko.widget.DoorhangerConfig;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.mozilla.gecko.widget.DoorHanger.Type;
|
||||
|
||||
public class DoorHangerPopup extends AnchoredPopup
|
||||
implements BundleEventListener,
|
||||
Tabs.OnTabsChangedListener,
|
||||
@ -289,7 +291,9 @@ public class DoorHangerPopup extends AnchoredPopup
|
||||
|
||||
final String baseDomain = tab.getBaseDomain();
|
||||
|
||||
if (TextUtils.isEmpty(baseDomain)) {
|
||||
if (firstDoorhanger.getType() == Type.ADDON) {
|
||||
firstDoorhanger.showTitle(null, mContext.getString(R.string.addons));
|
||||
} else if (TextUtils.isEmpty(baseDomain)) {
|
||||
firstDoorhanger.hideTitle();
|
||||
} else {
|
||||
firstDoorhanger.showTitle(tab.getFavicon(), baseDomain);
|
||||
|
@ -9,6 +9,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.view.LayoutInflater;
|
||||
@ -41,7 +42,17 @@ public abstract class DoorHanger extends LinearLayout {
|
||||
}
|
||||
|
||||
// Doorhanger types created from Gecko are checked against enum strings to determine type.
|
||||
public static enum Type { DEFAULT, LOGIN, TRACKING, GEOLOCATION, DESKTOPNOTIFICATION2, WEBRTC, VIBRATION, FLYWEBPUBLISHSERVER }
|
||||
public enum Type {
|
||||
DEFAULT,
|
||||
LOGIN,
|
||||
TRACKING,
|
||||
GEOLOCATION,
|
||||
DESKTOPNOTIFICATION2,
|
||||
WEBRTC,
|
||||
VIBRATION,
|
||||
FLYWEBPUBLISHSERVER,
|
||||
ADDON
|
||||
}
|
||||
|
||||
public interface OnButtonClickListener {
|
||||
public void onButtonClick(GeckoBundle response, DoorHanger doorhanger);
|
||||
@ -143,6 +154,10 @@ public abstract class DoorHanger extends LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public int getTabId() {
|
||||
return mTabId;
|
||||
}
|
||||
@ -207,7 +222,7 @@ public abstract class DoorHanger extends LinearLayout {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void showTitle(Bitmap favicon, String title) {
|
||||
public void showTitle(@Nullable Bitmap favicon, String title) {
|
||||
mDoorhangerTitle.setText(title);
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(mDoorhangerTitle, new BitmapDrawable(getResources(), favicon), null, null, null);
|
||||
if (favicon != null) {
|
||||
|
@ -5573,7 +5573,7 @@ var XPInstallObserver = {
|
||||
}];
|
||||
|
||||
let message = Strings.browser.GetStringFromName("notificationRestart.normal");
|
||||
NativeWindow.doorhanger.show(message, "addon-app-restart", buttons, BrowserApp.selectedTab.id, { persistence: -1 });
|
||||
NativeWindow.doorhanger.show(message, "addon-app-restart", buttons, BrowserApp.selectedTab.id, { persistence: -1 }, "ADDON");
|
||||
},
|
||||
|
||||
hideRestartPrompt: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user