This commit is contained in:
deepak1556 2017-01-23 18:50:30 +05:30
Родитель c15f6af892
Коммит e767c59da2
4 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -8,6 +8,7 @@
#include <vector>
#include "atom/browser/ui/webui/pdf_viewer_ui.h"
#include "atom/common/atom_constants.h"
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
#include "atom/common/options_switches.h"
@ -116,9 +117,9 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
pdf_info.is_out_of_process = true;
pdf_info.name = "Chromium PDF Viewer";
pdf_info.description = "Portable Document Format";
pdf_info.path = base::FilePath::FromUTF8Unsafe(PdfViewerUI::kOrigin);
content::WebPluginMimeType pdf_mime_type("application/x-google-chrome-pdf",
"pdf", "Portable Document Format");
pdf_info.path = base::FilePath::FromUTF8Unsafe(kPdfPluginPath);
content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf",
"Portable Document Format");
pdf_info.mime_types.push_back(pdf_mime_type);
pdf_info.internal_entry_points.get_interface = chrome_pdf::PPP_GetInterface;
pdf_info.internal_entry_points.initialize_module =

Просмотреть файл

@ -24,4 +24,7 @@ const char kSecureProtocolDescription[] =
"The connection to this site is using a strong protocol version "
"and cipher suite.";
const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf";
const char kPdfPluginPath[] = "chrome://pdf-viewer/";
} // namespace atom

Просмотреть файл

@ -20,6 +20,10 @@ extern const char kValidCertificateDescription[];
extern const char kSecureProtocol[];
extern const char kSecureProtocolDescription[];
// The MIME type used for the PDF plugin.
extern const char kPdfPluginMimeType[];
extern const char kPdfPluginPath[];
} // namespace atom
#endif // ATOM_COMMON_ATOM_CONSTANTS_H_

Просмотреть файл

@ -12,6 +12,7 @@
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/api/event_emitter_caller.h"
#include "atom/common/atom_constants.h"
#include "atom/common/color_util.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h"
@ -274,8 +275,9 @@ void AtomRendererClient::RenderFrameCreated(
// This is required for widevine plugin detection provided during runtime.
blink::resetPluginCache();
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
GURL("chrome://pdf-viewer/"), "file", "", true);
// Allow access to file scheme from pdf viewer.
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(GURL(kPdfPluginPath),
"file", "", true);
// Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list =
@ -342,6 +344,7 @@ bool AtomRendererClient::OverrideCreatePlugin(
blink::WebPlugin** plugin) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (params.mimeType.utf8() == content::kBrowserPluginMimeType ||
params.mimeType.utf8() == kPdfPluginMimeType ||
command_line->HasSwitch(switches::kEnablePlugins))
return false;