summaryrefslogtreecommitdiffstats
path: root/components/pdf/common
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@chromium.org>2014-08-27 23:50:36 -0400
committerSadrul Habib Chowdhury <sadrul@chromium.org>2014-08-28 03:51:28 +0000
commit2f8807f697e2c043c857ec37c43d45573d239d8f (patch)
tree3e067a88970845d20d703c94d8ca7afbdc1445e9 /components/pdf/common
parent99492bedc3bd5ac3a26b12fbf7599a55086a998e (diff)
downloadchromium_src-2f8807f697e2c043c857ec37c43d45573d239d8f.zip
chromium_src-2f8807f697e2c043c857ec37c43d45573d239d8f.tar.gz
chromium_src-2f8807f697e2c043c857ec37c43d45573d239d8f.tar.bz2
pdf: Create a separate component for using the pdf pepper plugin.
Create a component necessary for showing PDF in a content-based client. Much of the relevant code currently lives in //chrome/, and is usable by chrome. Moving this code into a separate component in //components/pdf/ allows it to be easily used by other content-clients (e.g. app-shell, athena, etc.). This patch moves PPB_PDF_Impl (implementation for the PPB_PDF interface in ppapi) and the relevant IPC messages in the pdf component. A short summary of the changes in this patch: . Move ppb_pdf_impl.cc|h into //components/pdf from //chrome/renderer/pepper . Put this code in the 'pdf' namespace. This code lives in 'pdf_renderer' target. 'chrome_renderer' depends on this target. . Move the following IPC messages from render_messages.h to pdf_messages.h: - PDFUpdateContentRestrictions - PDFHasUnsupportedFeature - PDFSaveURLAs - PDFModalPromptForPassword Change the prefix of these messages from ChromeViewHostMsg_ to PDFHostMsg_ . Move PDFTabHelper into //components/pdf from //chrome/browser/ui/pdf. Put this code in the 'pdf' namespace. This code lives in 'pdf_browser' target. 'chrome_browser' depends on this target. BUG=401242 R=blundell@chromium.org, raymes@chromium.org, thestig@chromium.org, tsepez@chromium.org TBR=darin@chromium.org for DEPS Review URL: https://codereview.chromium.org/477263003 Cr-Commit-Position: refs/heads/master@{#292313}
Diffstat (limited to 'components/pdf/common')
-rw-r--r--components/pdf/common/BUILD.gn20
-rw-r--r--components/pdf/common/OWNERS11
-rw-r--r--components/pdf/common/pdf_message_generator.cc33
-rw-r--r--components/pdf/common/pdf_message_generator.h7
-rw-r--r--components/pdf/common/pdf_messages.h31
5 files changed, 102 insertions, 0 deletions
diff --git a/components/pdf/common/BUILD.gn b/components/pdf/common/BUILD.gn
new file mode 100644
index 0000000..adff35e
--- /dev/null
+++ b/components/pdf/common/BUILD.gn
@@ -0,0 +1,20 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/features.gni")
+
+static_library("common") {
+ sources = [
+ "pdf_message_generator.cc",
+ "pdf_message_generator.h",
+ "pdf_messages.h",
+ ]
+
+ deps = [
+ "//base",
+ "//content/public/common",
+ "//ipc",
+ "//url",
+ ]
+}
diff --git a/components/pdf/common/OWNERS b/components/pdf/common/OWNERS
new file mode 100644
index 0000000..faa1757
--- /dev/null
+++ b/components/pdf/common/OWNERS
@@ -0,0 +1,11 @@
+# Changes to IPC messages require a security review to avoid introducing
+# new sandbox escapes.
+per-file *_messages*.h=set noparent
+per-file *_messages*.h=cevans@chromium.org
+per-file *_messages*.h=dcheng@chromium.org
+per-file *_messages*.h=inferno@chromium.org
+per-file *_messages*.h=jln@chromium.org
+per-file *_messages*.h=jschuh@chromium.org
+per-file *_messages*.h=kenrb@chromium.org
+per-file *_messages*.h=nasko@chromium.org
+per-file *_messages*.h=tsepez@chromium.org
diff --git a/components/pdf/common/pdf_message_generator.cc b/components/pdf/common/pdf_message_generator.cc
new file mode 100644
index 0000000..025d94c
--- /dev/null
+++ b/components/pdf/common/pdf_message_generator.cc
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "components/pdf/common/pdf_message_generator.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "components/pdf/common/pdf_message_generator.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "components/pdf/common/pdf_message_generator.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "components/pdf/common/pdf_message_generator.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "components/pdf/common/pdf_message_generator.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "components/pdf/common/pdf_message_generator.h"
+} // namespace IPC
diff --git a/components/pdf/common/pdf_message_generator.h b/components/pdf/common/pdf_message_generator.h
new file mode 100644
index 0000000..c55d672
--- /dev/null
+++ b/components/pdf/common/pdf_message_generator.h
@@ -0,0 +1,7 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, no traditional include guard.
+
+#include "components/pdf/common/pdf_messages.h"
diff --git a/components/pdf/common/pdf_messages.h b/components/pdf/common/pdf_messages.h
new file mode 100644
index 0000000..0973923
--- /dev/null
+++ b/components/pdf/common/pdf_messages.h
@@ -0,0 +1,31 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, no traditional include guard.
+#include <string.h>
+
+#include "content/public/common/common_param_traits.h"
+#include "content/public/common/common_param_traits_macros.h"
+#include "content/public/common/referrer.h"
+#include "ipc/ipc_message_macros.h"
+#include "url/gurl.h"
+
+#define IPC_MESSAGE_START PDFMsgStart
+
+// Updates the content restrictions, i.e. to disable print/copy.
+IPC_MESSAGE_ROUTED1(PDFHostMsg_PDFUpdateContentRestrictions,
+ int /* restrictions */)
+
+// The currently displayed PDF has an unsupported feature.
+IPC_MESSAGE_ROUTED0(PDFHostMsg_PDFHasUnsupportedFeature)
+
+// Brings up SaveAs... dialog to save specified URL.
+IPC_MESSAGE_ROUTED2(PDFHostMsg_PDFSaveURLAs,
+ GURL /* url */,
+ content::Referrer /* referrer */)
+
+// Brings up a Password... dialog for protected documents.
+IPC_SYNC_MESSAGE_ROUTED1_1(PDFHostMsg_PDFModalPromptForPassword,
+ std::string /* prompt */,
+ std::string /* actual_value */)