mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 47fb4821 (#318735).
- Remove the in-process PDF plugin implementation. A new implementation is now required (issue #1565). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2043 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
#include "include/internal/cef_logging_internal.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
|
||||
#include "base/debug/trace_event.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
||||
// The contents of this file are a compilation unit that is not called by other
|
||||
// functions in the the library. Consiquently MSVS will exclude it during the
|
||||
|
@@ -10,60 +10,18 @@
|
||||
#include "libcef/common/scheme_registration.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace {
|
||||
|
||||
CefContentClient* g_content_client = NULL;
|
||||
|
||||
const char kPDFPluginName[] = "Chrome PDF Viewer";
|
||||
const char kPDFPluginMimeType[] = "application/pdf";
|
||||
const char kPDFPluginExtension[] = "pdf";
|
||||
const char kPDFPluginDescription[] = "Portable Document Format";
|
||||
const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
|
||||
ppapi::PERMISSION_DEV;
|
||||
|
||||
// Appends the known built-in plugins to the given vector.
|
||||
// Based on chrome/common/chrome_content_client.cc.
|
||||
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||
// PDF.
|
||||
//
|
||||
// Once we're sandboxed, we can't know if the PDF plugin is available or not;
|
||||
// but (on Linux) this function is always called once before we're sandboxed.
|
||||
// So the first time through test if the file is available and then skip the
|
||||
// check on subsequent calls if yes.
|
||||
static bool skip_pdf_file_check = false;
|
||||
base::FilePath path;
|
||||
if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
|
||||
if (skip_pdf_file_check || base::PathExists(path)) {
|
||||
content::PepperPluginInfo pdf;
|
||||
pdf.path = path;
|
||||
pdf.name = kPDFPluginName;
|
||||
// Only in-process loading is currently supported. See issue #1331.
|
||||
pdf.is_out_of_process = false;
|
||||
content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
|
||||
kPDFPluginExtension,
|
||||
kPDFPluginDescription);
|
||||
pdf.mime_types.push_back(pdf_mime_type);
|
||||
pdf.permissions = kPDFPluginPermissions;
|
||||
plugins->push_back(pdf);
|
||||
|
||||
skip_pdf_file_check = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefContentClient::CefContentClient(CefRefPtr<CefApp> application)
|
||||
@@ -84,11 +42,6 @@ CefContentClient* CefContentClient::Get() {
|
||||
return g_content_client;
|
||||
}
|
||||
|
||||
void CefContentClient::AddPepperPlugins(
|
||||
std::vector<content::PepperPluginInfo>* plugins) {
|
||||
ComputeBuiltInPlugins(plugins);
|
||||
}
|
||||
|
||||
void CefContentClient::AddAdditionalSchemes(
|
||||
std::vector<std::string>* standard_schemes,
|
||||
std::vector<std::string>* savable_schemes) {
|
||||
|
@@ -26,8 +26,6 @@ class CefContentClient : public content::ContentClient,
|
||||
static CefContentClient* Get();
|
||||
|
||||
// content::ContentClient methods.
|
||||
void AddPepperPlugins(
|
||||
std::vector<content::PepperPluginInfo>* plugins) override;
|
||||
void AddAdditionalSchemes(
|
||||
std::vector<std::string>* standard_schemes,
|
||||
std::vector<std::string>* savable_schemes) override;
|
||||
|
@@ -84,10 +84,6 @@ base::FilePath GetResourcesFilePath() {
|
||||
return GetFrameworkBundlePath().Append(FILE_PATH_LITERAL("Resources"));
|
||||
}
|
||||
|
||||
base::FilePath GetLibrariesFilePath() {
|
||||
return GetFrameworkBundlePath().Append(FILE_PATH_LITERAL("Libraries"));
|
||||
}
|
||||
|
||||
void OverrideFrameworkBundlePath() {
|
||||
base::mac::SetOverrideFrameworkBundlePath(GetFrameworkBundlePath());
|
||||
}
|
||||
@@ -116,10 +112,6 @@ base::FilePath GetResourcesFilePath() {
|
||||
return pak_dir;
|
||||
}
|
||||
|
||||
base::FilePath GetLibrariesFilePath() {
|
||||
return GetResourcesFilePath();
|
||||
}
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
@@ -180,22 +172,6 @@ base::FilePath GetUserDataPath() {
|
||||
return result;
|
||||
}
|
||||
|
||||
// File name of the internal PDF plugin on different platforms.
|
||||
const base::FilePath::CharType kInternalPDFPluginFileName[] =
|
||||
#if defined(OS_WIN)
|
||||
FILE_PATH_LITERAL("pdf.dll");
|
||||
#elif defined(OS_MACOSX)
|
||||
FILE_PATH_LITERAL("PDF.plugin");
|
||||
#else // Linux and Chrome OS
|
||||
FILE_PATH_LITERAL("libpdf.so");
|
||||
#endif
|
||||
|
||||
void OverridePdfPluginPath() {
|
||||
base::FilePath plugin_path = GetLibrariesFilePath();
|
||||
plugin_path = plugin_path.Append(kInternalPDFPluginFileName);
|
||||
PathService::Override(chrome::FILE_PDF_PLUGIN, plugin_path);
|
||||
}
|
||||
|
||||
// Returns true if |scale_factor| is supported by this platform.
|
||||
// Same as ResourceBundle::IsScaleFactorSupported.
|
||||
bool IsScaleFactorSupported(ui::ScaleFactor scale_factor) {
|
||||
@@ -489,17 +465,10 @@ void CefMainDelegate::PreSandboxStartup() {
|
||||
true); // Create if necessary.
|
||||
}
|
||||
|
||||
OverridePdfPluginPath();
|
||||
|
||||
if (command_line->HasSwitch(switches::kDisablePackLoading))
|
||||
content_client_.set_pack_loading_disabled(true);
|
||||
|
||||
InitializeResourceBundle();
|
||||
|
||||
if (process_type == switches::kUtilityProcess ||
|
||||
process_type == switches::kZygoteProcess) {
|
||||
CefContentUtilityClient::PreSandboxStartup();
|
||||
}
|
||||
}
|
||||
|
||||
int CefMainDelegate::RunProcess(
|
||||
|
Reference in New Issue
Block a user