Commit e4e9c553 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Make Print Preview work correctly at early startup.

Print Preview needs the PDF plugin to work, but plugin loading happens
asynchronously at startup. So querying the PluginService with
GetPluginInfoByPath() may fail because the plugins have not been loaded
yet.

However, since the PDF plugin is a built-in PPAPI plugin, it does not
need to be loaded from disk asynchronously. Since it is already
registered, call GetRegisteredPpapiPluginInfo() instead.

BUG=857074

Change-Id: I729b40329f1de92da6789efbbbae7e2c09ab8b51
Reviewed-on: https://chromium-review.googlesource.com/1175553
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583392}
parent fe158101
...@@ -40,15 +40,14 @@ void EnableInternalPDFPluginForContents(int render_process_id, ...@@ -40,15 +40,14 @@ void EnableInternalPDFPluginForContents(int render_process_id,
// Always enable the internal PDF plugin for the print preview page. // Always enable the internal PDF plugin for the print preview page.
static const base::FilePath pdf_plugin_path( static const base::FilePath pdf_plugin_path(
ChromeContentClient::kPDFPluginPath); ChromeContentClient::kPDFPluginPath);
auto* plugin_service = content::PluginService::GetInstance();
content::WebPluginInfo pdf_plugin; const content::PepperPluginInfo* info =
if (!content::PluginService::GetInstance()->GetPluginInfoByPath( plugin_service->GetRegisteredPpapiPluginInfo(pdf_plugin_path);
pdf_plugin_path, &pdf_plugin)) { if (!info)
return; return;
}
ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame( ChromePluginServiceFilter::GetInstance()->OverridePluginForFrame(
render_process_id, render_frame_id, GURL(), pdf_plugin); render_process_id, render_frame_id, GURL(), info->ToWebPluginInfo());
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment