Commit ac4f451c authored by Marshall Greenblatt's avatar Marshall Greenblatt

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
parent a9191b26
......@@ -7,5 +7,5 @@
# https://code.google.com/p/chromiumembedded/wiki/BranchesAndBuilding
{
'chromium_checkout': 'beafd8cb70f31a44502a9040af396b8cd61dcdb1',
'chromium_checkout': '47fb4821713cf85fce53c5bae575343e97041681',
}
......@@ -863,9 +863,6 @@
'<(DEPTH)/components/components.gyp:keyed_service_content',
'<(DEPTH)/components/components.gyp:keyed_service_core',
'<(DEPTH)/components/components.gyp:navigation_interception',
'<(DEPTH)/components/components.gyp:pdf_browser',
'<(DEPTH)/components/components.gyp:pdf_common',
'<(DEPTH)/components/components.gyp:pdf_renderer',
'<(DEPTH)/components/components.gyp:pref_registry',
'<(DEPTH)/components/components.gyp:printing_common',
'<(DEPTH)/components/components.gyp:printing_renderer',
......@@ -886,17 +883,16 @@
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/net/net.gyp:net_with_v8',
'<(DEPTH)/pdf/pdf.gyp:pdf',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/storage/storage_browser.gyp:storage',
'<(DEPTH)/sync/sync.gyp:sync',
'<(DEPTH)/third_party/hunspell/hunspell.gyp:hunspell',
'<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
'<(DEPTH)/third_party/re2/re2.gyp:re2',
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
'<(DEPTH)/third_party/WebKit/Source/core/core.gyp:webcore',
'<(DEPTH)/third_party/zlib/zlib.gyp:minizip',
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/base/ime/ui_base_ime.gyp:ui_base_ime',
'<(DEPTH)/ui/base/ui_base.gyp:ui_base',
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
# Necessary to generate the grit include files.
......@@ -1152,8 +1148,6 @@
'<(DEPTH)/chrome/browser/printing/printer_query.h',
'<(DEPTH)/chrome/common/extensions/extension_constants.cc',
'<(DEPTH)/chrome/common/extensions/extension_constants.h',
'<(DEPTH)/chrome/renderer/pepper/chrome_pdf_print_client.cc',
'<(DEPTH)/chrome/renderer/pepper/chrome_pdf_print_client.h',
'<(DEPTH)/extensions/common/constants.cc',
'<(DEPTH)/extensions/common/constants.h',
# Include header for stub creation (BrowserProcess) so print_job_worker can
......@@ -1199,6 +1193,10 @@
],
'conditions': [
['OS=="win"', {
'dependencies': [
# For printing using PDF.
'<(DEPTH)/pdf/pdf.gyp:pdf',
],
'sources': [
'<@(includes_win)',
'libcef/browser/browser_host_impl_win.cc',
......@@ -1351,11 +1349,10 @@
],
'copies': [
{
# Copy binaries for HTML5 audio/video and PDF support.
# Copy binaries for HTML5 audio/video support.
'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
'files': [
'<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/PDF.plugin',
],
},
{
......
......@@ -36,10 +36,8 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "components/pdf/common/pdf_messages.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/view_messages.h"
......@@ -2558,13 +2556,6 @@ 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(PDFHostMsg_PDFHasUnsupportedFeature,
OnPDFHasUnsupportedFeature)
IPC_MESSAGE_HANDLER(PDFHostMsg_PDFSaveURLAs, OnPDFSaveURLAs)
IPC_MESSAGE_HANDLER(PDFHostMsg_PDFUpdateContentRestrictions,
OnPDFUpdateContentRestrictions)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PDFHostMsg_PDFModalPromptForPassword,
OnPDFModalPromptForPassword)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
......@@ -2659,38 +2650,6 @@ 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) {
PDFHostMsg_PDFModalPromptForPassword::WriteReplyParams(
reply_message, base::UTF16ToUTF8(actual_value));
Send(reply_message);
}
// content::NotificationObserver methods.
// -----------------------------------------------------------------------------
......
......@@ -478,16 +478,6 @@ 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.
void Observe(int type,
......
......@@ -24,7 +24,6 @@
#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_switches.h"
#include "net/base/net_module.h"
#include "net/proxy/proxy_resolver_v8.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA)
......@@ -115,9 +114,6 @@ int CefBrowserMainParts::PreCreateThreads() {
pref_store_->SetInitializationCompleted();
pref_service_ = pref_store_->CreateService().Pass();
// Initialize the V8 proxy integration.
net::ProxyResolverV8::EnsureIsolateCreated();
return 0;
}
......
......@@ -239,6 +239,12 @@ component_updater::PnaclComponentInstaller*
return NULL;
}
component_updater::SupervisedUserWhitelistInstaller*
ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
NOTIMPLEMENTED();
return NULL;
}
MediaFileSystemRegistry*
ChromeBrowserProcessStub::media_file_system_registry() {
NOTIMPLEMENTED();
......
......@@ -86,6 +86,8 @@ class ChromeBrowserProcessStub : public BrowserProcess {
CRLSetFetcher* crl_set_fetcher() override;
component_updater::PnaclComponentInstaller*
pnacl_component_installer() override;
component_updater::SupervisedUserWhitelistInstaller*
supervised_user_whitelist_installer() override;
MediaFileSystemRegistry*
media_file_system_registry() override;
bool created_local_state() const override;
......
......@@ -932,7 +932,6 @@ void CefContentBrowserClient::ResourceDispatcherHostCreated() {
void CefContentBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* rvh,
const GURL& url,
content::WebPreferences* prefs) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
......
......@@ -132,7 +132,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool* no_javascript_access) override;
void ResourceDispatcherHostCreated() override;
void OverrideWebkitPrefs(content::RenderViewHost* rvh,
const GURL& url,
content::WebPreferences* prefs) override;
SkColor GetBaseBackgroundColor(content::RenderViewHost* rvh) override;
void BrowserURLHandlerCreated(
......
......@@ -545,6 +545,7 @@ void CefCookieManagerImpl::SetCookieInternal(
expiration_time,
cookie.secure ? true : false,
cookie.httponly ? true : false,
false, // First-party only.
net::COOKIE_PRIORITY_DEFAULT,
base::Bind(SetCookieCallbackImpl, callback));
}
......
......@@ -12,19 +12,80 @@
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "net/base/net_util.h"
#include "third_party/skia/include/core/SkColor.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_response_writer.h"
namespace {
// ResponseWriter -------------------------------------------------------------
class ResponseWriter : public net::URLFetcherResponseWriter {
public:
ResponseWriter(base::WeakPtr<CefDevToolsFrontend> devtools_,
int stream_id);
~ResponseWriter() override;
// URLFetcherResponseWriter overrides:
int Initialize(const net::CompletionCallback& callback) override;
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override;
int Finish(const net::CompletionCallback& callback) override;
private:
base::WeakPtr<CefDevToolsFrontend> devtools_;
int stream_id_;
DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
};
ResponseWriter::ResponseWriter(
base::WeakPtr<CefDevToolsFrontend> devtools,
int stream_id)
: devtools_(devtools),
stream_id_(stream_id) {
}
ResponseWriter::~ResponseWriter() {
}
int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
return net::OK;
}
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes));
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&CefDevToolsFrontend::CallClientFunction,
devtools_, "DevToolsAPI.streamWrite",
base::Owned(id), base::Owned(chunk), nullptr));
return num_bytes;
}
int ResponseWriter::Finish(const net::CompletionCallback& callback) {
return net::OK;
}
// This constant should be in sync with
// the constant at devtools_ui_bindings.cc.
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
......@@ -82,21 +143,36 @@ void CefDevToolsFrontend::Focus() {
web_contents()->Focus();
}
void CefDevToolsFrontend::InspectElementAt(int x, int y) {
if (agent_host_)
agent_host_->InspectElement(x, y);
}
void CefDevToolsFrontend::Close() {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::CloseBrowser, frontend_browser_.get(),
true));
}
void CefDevToolsFrontend::DisconnectFromTarget() {
if (!agent_host_)
return;
agent_host_->DetachClient();
agent_host_ = NULL;
}
CefDevToolsFrontend::CefDevToolsFrontend(
CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::DevToolsAgentHost* agent_host)
: WebContentsObserver(frontend_browser->GetWebContents()),
frontend_browser_(frontend_browser),
agent_host_(agent_host) {
agent_host_(agent_host),
weak_factory_(this) {
}
CefDevToolsFrontend::~CefDevToolsFrontend() {
for (const auto& pair : pending_requests_)
delete pair.first;
}
void CefDevToolsFrontend::RenderViewCreated(
......@@ -105,19 +181,27 @@ void CefDevToolsFrontend::RenderViewCreated(
frontend_host_.reset(
content::DevToolsFrontendHost::Create(
web_contents()->GetMainFrame(), this));
agent_host_->AttachClient(this);
}
}
void CefDevToolsFrontend::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (agent_host_)
agent_host_->AttachClient(this);
}
void CefDevToolsFrontend::WebContentsDestroyed() {
agent_host_->DetachClient();
if (agent_host_)
agent_host_->DetachClient();
delete this;
}
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
const std::string& message) {
if (!agent_host_)
return;
std::string method;
int id = 0;
base::ListValue* params = NULL;
base::DictionaryValue* dict = NULL;
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
......@@ -126,6 +210,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
!dict->GetString("method", &method)) {
return;
}
int request_id = 0;
dict->GetInteger("id", &request_id);
dict->GetList("params", &params);
std::string browser_message;
......@@ -135,22 +221,47 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
} else if (method == "loadCompleted") {
web_contents()->GetMainFrame()->ExecuteJavaScript(
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"));
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
// TODO(pfeldman): handle some of the embedder messages in content.
std::string url;
std::string headers;
int stream_id;
if (!params->GetString(0, &url) ||
!params->GetString(1, &headers) ||
!params->GetInteger(2, &stream_id)) {
return;
}
GURL gurl(url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
SendMessageAck(request_id, &response);
return;
}
net::URLFetcher* fetcher =
net::URLFetcher::Create(gurl, net::URLFetcher::GET, this);
pending_requests_[fetcher] = request_id;
fetcher->SetRequestContext(web_contents()->GetBrowserContext()->
GetRequestContext());
fetcher->SetExtraRequestHeaders(headers);
fetcher->SaveResponseWithWriter(scoped_ptr<net::URLFetcherResponseWriter>(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->Start();
return;
} else {
return;
}
dict->GetInteger("id", &id);
if (id) {
std::string code = "DevToolsAPI.embedderMessageAck(" +
base::IntToString(id) + ",\"\");";
base::string16 javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
}
if (request_id)
SendMessageAck(request_id, nullptr);
}
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
const std::string& message) {
agent_host_->DispatchProtocolMessage(message);
if (agent_host_)
agent_host_->DispatchProtocolMessage(message);
}
void CefDevToolsFrontend::DispatchProtocolMessage(
......@@ -174,6 +285,66 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
}
}
void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
// TODO(pfeldman): this is a copy of chrome's devtools_ui_bindings.cc.
// We should handle some of the commands including this one in content.
DCHECK(source);
PendingRequestsMap::iterator it = pending_requests_.find(source);
DCHECK(it != pending_requests_.end());
base::DictionaryValue response;
base::DictionaryValue* headers = new base::DictionaryValue();
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
response.Set("headers", headers);
void* iterator = NULL;
std::string name;
std::string value;
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
headers->SetString(name, value);
SendMessageAck(it->second, &response);
pending_requests_.erase(it);
delete source;
}
void CefDevToolsFrontend::CallClientFunction(
const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3) {
std::string javascript = function_name + "(";
if (arg1) {
std::string json;
base::JSONWriter::Write(arg1, &json);
javascript.append(json);
if (arg2) {
base::JSONWriter::Write(arg2, &json);
javascript.append(", ").append(json);
if (arg3) {
base::JSONWriter::Write(arg3, &json);
javascript.append(", ").append(json);
}
}
}
javascript.append(");");
web_contents()->GetMainFrame()->ExecuteJavaScript(
base::UTF8ToUTF16(javascript));
}
void CefDevToolsFrontend::SendMessageAck(int request_id,
const base::Value* arg) {
base::FundamentalValue id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr);
}
void CefDevToolsFrontend::AttachTo(content::WebContents* inspected_contents) {
DisconnectFromTarget();
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(inspected_contents);
}
void CefDevToolsFrontend::AgentHostClosed(
content::DevToolsAgentHost* agent_host,
bool replaced) {
......
......@@ -11,9 +11,15 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/url_request/url_fetcher_delegate.h"
namespace base {
class Value;
}
namespace content {
class RenderViewHost;
......@@ -22,7 +28,8 @@ class WebContents;
class CefDevToolsFrontend : public content::WebContentsObserver,
public content::DevToolsFrontendHost::Delegate,
public content::DevToolsAgentHostClient {
public content::DevToolsAgentHostClient,
public net::URLFetcherDelegate {
public:
static CefDevToolsFrontend* Show(
CefRefPtr<CefBrowserHostImpl> inspected_browser,
......@@ -33,39 +40,56 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
void Activate();
void Focus();
void InspectElementAt(int x, int y);
void Close();
void DisconnectFromTarget();
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
return frontend_browser_;
}
void CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3);
private:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::DevToolsAgentHost* agent_host);
~CefDevToolsFrontend() override;
// WebContentsObserver overrides.
void RenderViewCreated(
content::RenderViewHost* render_view_host) override;
// content::DevToolsAgentHostClient implementation.
void AgentHostClosed(content::DevToolsAgentHost* agent_host,
bool replaced) override;
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
const std::string& message) override;
void AttachTo(content::WebContents* inspected_contents);
// WebContentsObserver overrides
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) override;
void WebContentsDestroyed() override;
// content::DevToolsFrontendHost::Delegate implementation.
void HandleMessageFromDevToolsFrontend(
const std::string& message) override;
void HandleMessageFromDevToolsFrontend(const std::string& message) override;
void HandleMessageFromDevToolsFrontendToBackend(
const std::string& message) override;
// content::DevToolsAgentHostClient implementation.
void DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host,
const std::string& message) override;
void AgentHostClosed(
content::DevToolsAgentHost* agent_host,
bool replaced) override;
// net::URLFetcherDelegate overrides.
void OnURLFetchComplete(const net::URLFetcher* source) override;
void SendMessageAck(int request_id,
const base::Value* arg1);
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
scoped_refptr<content::DevToolsAgentHost> agent_host_;
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
using PendingRequestsMap = std::map<const net::URLFetcher*, int>;
PendingRequestsMap pending_requests_;
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
};
......
......@@ -6,8 +6,8 @@
#include "include/cef_trace.h"
#include "libcef/browser/thread_util.h"
#include "base/debug/trace_event.h"
#include "base/files/file_util.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/tracing_controller.h"
namespace {
......@@ -57,8 +57,8 @@ bool CefTraceSubscriber::BeginTracing(
}
TracingController::GetInstance()->EnableRecording(
base::debug::CategoryFilter(categories),
base::debug::TraceOptions(),
base::trace_event::CategoryFilter(categories),
base::trace_event::TraceOptions(),
done_callback);
return true;
}
......
......@@ -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,