[ MimeHandlerView ] Fix a crash in FrameContainer

MimeHandlerViewFrameContainer is not observing the lifetime of its
embedder RenderFrame. This could cause a crash when the renderer
(embedder) sets an <iframe>'s source to a PDF type and then removes the
frame sometime later. The RenderFrame is deleted instantly but MHVFC
is removed after the IPC round-trip: RenderFrameProxy associated with
MHVFC is removed, this destroys guest which will notify the MHVFC to
delete itself. At this point MHVFC cannot find its RenderFrame and
is not removed from the global map.

This CL adds a lifetime observer helper class which clears MHVFC from
global map as soon as the embedder frame goes away. This is similar to
what GuestViewContainer does.

Bug: 930803
Change-Id: Ieedda08d79cc7c9ef703b371e4ffe08337a8cc5f
Reviewed-on: https://chromium-review.googlesource.com/c/1465065
Commit-Queue: Ehsan Karamad <[email protected]>
Reviewed-by: James MacLean <[email protected]>
Cr-Commit-Position: refs/heads/master@{#631269}
4 files changed