Commit Graph
6 Commits
Author SHA1 Message Date
Jan Henning 700c57d0d8 Bug 1414084 - Part 15 - Correctly remove already resolved PageActions, too. r=Grisha
When a PageActions:Remove message arrives and we cannot simply forward it, we
need to remove not just pending PageActions:Add messages, but also any already
present PageActions objects that a former PageActionLayout had handed to us.

MozReview-Commit-ID: 3jnGsmMuVfa
2018-03-03 18:11:57 +01:00
Jan Henning a0703fa158 Bug 1414084 - Part 13 - Cache PageActions. r=Grisha
Since converting a PageAction message into an actual PageAction object also en-
tails parsing the image data URL into a drawable, we leave that task to the
PageActionLayout.

This means that the PageAction cache needs to operate slightly differently than
the MenuItem cache. First, we store all PageAction BundleEvent messages that
arrive while no PageActionLayout is ready and then forward them en masse when
one becomes available. Secondly, if the PageActionLayout is going away again,
we then also take a list of already parsed PageAction objects for safekeeping.

MozReview-Commit-ID: AcPPONXqe46
2018-02-26 21:50:50 +01:00
Jan Henning 0e1e505c2c Bug 1414084 - Part 12 - Add some tests for the processing of Menu messages. r=Grisha
MozReview-Commit-ID: D8Aujo1PgIk
2018-03-19 20:06:32 +01:00
Jan Henning 00cb8b26f6 Bug 1414084 - Part 11 - Use a Map for the MenuItemInfo list. r=Grisha
Since all related EventDispatcher messages use UUIDs, it makes sense to store
our MenuItemInfos in a Map, so we can access them directly by UUID instead of
having to iterate over them until we've found the desired one.

Since we want to preserve the order in which MenuItemInfos were added, we use a
LinkedHashMap.

MozReview-Commit-ID: BEtJ59tX59m
2018-03-18 18:07:16 +01:00
Jan Henning 7151f058ff Bug 1414084 - Part 10 - Init MenuItemInfo list right from the start. r=Grisha
The small savings in initialising this on demand the first time a menu item is
added, are not worth the additional complexity in null checks and the like.

MozReview-Commit-ID: Lcz09Ds8NxJ
2018-03-18 17:47:33 +01:00
Jan Henning d213aaca38 Bug 1414084 - Part 9 - Move add-on menu item cache out of BrowserApp. r=Grisha
Bug 832990 solved the issue of us losing the menu item cache if BrowserApp was
destroyed, however the issue remains that we'll miss any Menu:... messages that
are sent while BrowserApp doesn't exist, e.g. if Gecko is initially loaded
through a GeckoView-based activity.

Therefore we now move the menu item cache and the listener for those messages
into a separate class, whose lifetime better matches that of Gecko.

Apart from any necessary changes, we move the existing code as is. The only
additional change is that we make addAddonMenuItemToMenu() static, because we
can.

MozReview-Commit-ID: BJleonLnjmo
2018-02-25 22:22:37 +01:00