Bundle pepper PDF plugin on all platforms (issue #1331).

- Add new libpdf.so library on Linux and PDF.plugin app bundle on OS X.
- Move scaled resources from cef.pak into separate cef_100_percent.pak and cef_200_percent.pak files.
- Password-protected PDF files are not currently supported.
- No fallback is provided for PDF files that contain unsupported features.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1758 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-07-07 22:17:33 +00:00
parent 479e69fd4e
commit 81f8883b4a
14 changed files with 315 additions and 34 deletions

View File

@@ -35,6 +35,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/view_messages.h"
@@ -2431,6 +2432,14 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest)
IPC_MESSAGE_HANDLER(CefHostMsg_Response, OnResponse)
IPC_MESSAGE_HANDLER(CefHostMsg_ResponseAck, OnResponseAck)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature,
OnPDFHasUnsupportedFeature)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFSaveURLAs, OnPDFSaveURLAs)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFUpdateContentRestrictions,
OnPDFUpdateContentRestrictions)
IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChromeViewHostMsg_PDFModalPromptForPassword,
OnPDFModalPromptForPassword)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -2525,6 +2534,38 @@ void CefBrowserHostImpl::OnResponseAck(int request_id) {
response_manager_->RunAckHandler(request_id);
}
void CefBrowserHostImpl::OnPDFHasUnsupportedFeature() {
// TODO(cef): Use Adobe PDF plugin instead. See PDFHasUnsupportedFeature in
// chrome/browser/ui/pdf/pdf_unsupported_feature.cc.
}
void CefBrowserHostImpl::OnPDFSaveURLAs(
const GURL& url,
const content::Referrer& referrer) {
web_contents()->SaveFrame(url, referrer);
}
void CefBrowserHostImpl::OnPDFUpdateContentRestrictions(
int content_restrictions) {
// TODO(cef): Add support for communicating PDF content restrictions.
}
void CefBrowserHostImpl::OnPDFModalPromptForPassword(
const std::string& prompt,
IPC::Message* reply_message) {
// TODO(cef): Add support for PDF password prompt.
OnPDFModalPromptForPasswordClosed(reply_message, false, base::string16());
}
void CefBrowserHostImpl::OnPDFModalPromptForPasswordClosed(
IPC::Message* reply_message,
bool success,
const base::string16& actual_value) {
ChromeViewHostMsg_PDFModalPromptForPassword::WriteReplyParams(
reply_message, base::UTF16ToUTF8(actual_value));
Send(reply_message);
}
// content::NotificationObserver methods.
// -----------------------------------------------------------------------------

View File

@@ -331,18 +331,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// can only be dereferenced on, the UI thread.
base::WeakPtr<CefBrowserHostImpl> GetWeakPtr();
private:
class DevToolsWebContentsObserver;
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
const CefWindowInfo& window_info,
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefWindowHandle opener,
CefRefPtr<CefRequestContext> request_context);
// content::WebContentsDelegate methods.
virtual content::WebContents* OpenURLFromTab(
content::WebContents* source,
@@ -443,6 +431,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Override to provide a thread safe implementation.
virtual bool Send(IPC::Message* message) OVERRIDE;
private:
class DevToolsWebContentsObserver;
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
const CefWindowInfo& window_info,
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefWindowHandle opener,
CefRefPtr<CefRequestContext> request_context);
// content::WebContentsObserver::OnMessageReceived() message handlers.
void OnFrameIdentified(int64 frame_id,
int64 parent_frame_id,
@@ -456,6 +456,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
void OnRequest(const Cef_Request_Params& params);
void OnResponse(const Cef_Response_Params& params);
void OnResponseAck(int request_id);
void OnPDFHasUnsupportedFeature();
void OnPDFSaveURLAs(const GURL& url,
const content::Referrer& referrer);
void OnPDFUpdateContentRestrictions(int content_restrictions);
void OnPDFModalPromptForPassword(const std::string& prompt,
IPC::Message* reply_message);
void OnPDFModalPromptForPasswordClosed(IPC::Message* reply_message,
bool success,
const base::string16& actual_value);
// content::NotificationObserver methods.
virtual void Observe(int type,