Hello,
I'm investigating whether it's feasible to run an extension page (chrome-extensions://<id>/some_page.html) within an iframe.
I can easily embed the page but none of the allowed APIs like tabs available. If I load it as a main page (top-level frame) the APIs are available.
As far as I know the code responsible for making a document an extension page is in ExtensionWebContentsObserver which sends the ExtensionMsg_Loaded and ExtensionMsg_ActivateExtension messages to the Dispatcher in the renderer. The ExtensionWebContentsObserver does its work on RenderViewCreated which isn't called for iframes so I have tried handling RenderFrameCreated as well.
Unfortunately at this point I don't see a way to obtain the URL of the iframe at this point (RenderFrameHost::GetSiteInstance returns the SiteInstance for the main page).
My immediate question is: can I obtain the iframe URL in RenderFrameCreated and how?
But before I dig deeper into this, I'd like to also ask:
- Is this approach sane?
- What other problems should I expect along this path? Should I expect that many changes will be required also on the renderer side?
- In content/public/browser/render_frame_host.h one can read a comment: "Temporary until we get rid of RenderViewHost". Does it mean that the RenderViewHost will eventually be removed completely and the extensions code will have to work with RenderFrameHost? In that case, would my work towards running extensions inside iframes be of some use to the Chromium project and potentially worth upstreaming?
I'm doing this for a component extension and an internal page only so I'm not concerned about security issues that would arise if any arbitrary page was allowed to embed extensions pages.