PDF pepper plugin loading out-of-process

164 views
Skip to first unread message

Marshall Greenblatt

unread,
Jul 4, 2014, 12:06:47 AM7/4/14
to chromium-dev
Hi All,

I'm trying to get the PDF pepper plugin loading in my Content API-based application. I've managed to get the in-process code path working and am now attempting to understand the out-of-process code path.

Looking at ComputeBuiltInPlugins in chrome/common/chrome_content_client.cc it seems that with the out-of-process code path Chrome somehow intercepts requests for "application/pdf" mime types and substitutes the contents of chrome/browser/resources/pdf/index.html and associated resources. These resources then load the PDF plugin using the "application/x-google-chrome-pdf" mime type. I've gotten the out-of-process code path mostly working by directly associating the plugin with "application/pdf" (the pepper plugin loads, paints and updates the cursor) but now I need to load the resources instead of directly loading the plugin so that OutOfProcessInstance::HandleMessage will be called (otherwise the actual PDF contents are never drawn). Can anyone point me to the location in the code where the pdf resources are substituted for the plugin content?

Thanks,
Marshall

Raymes Khoury

unread,
Jul 4, 2014, 3:46:09 AM7/4/14
to magree...@gmail.com, chromium-dev
Hi Marshall,

The out of process plugin isn't quite finished yet. The way that it
works is that a chrome extension is associated with the PDF mime type.
This is a different mechanism to how plugins are loaded. The chrome
extension then loads a pepper plugin inside of it to render the PDF.

So loading the out of process plugin will require spinning up the
extensions framework. I'm not sure if this is feasible in your
application.

With that said, there isn't much which ties the viewer to the
extensions framework. If you have a look at the files in
src/chrome/browser/resources/pdf/ there are a bunch of <include> tags
in the html and js files. If you flatten these by manually copying in
the text of those files, you should be able to navigate to
file:///<chrome
repo>/src/chrome/browser/resources/pdf/index.html?<path to pdf> and
load a PDF using the out of process viewer. This doesn't help solve
the MIME type handling problem though.

Raymes
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev

pulkit...@gmail.com

unread,
Sep 6, 2018, 12:35:46 PM9/6/18
to Chromium-dev
Hey Marshall,

Quite an old thread but I wanted to know if there are different mime types for pdf for in-process and out-of-process plugins.
Reply all
Reply to author
Forward
0 new messages