SK_SUPPORT_LEGACY_DOCUMENT_FACTORY: clean up part 1/2

part 2 can follow after android patch lands.

Change-Id: If2a8135ac7384d84fd97d68933684ad8486d7471
Reviewed-on: https://skia-review.googlesource.com/156189
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/gn/shared_sources.gni b/gn/shared_sources.gni
index cfe43c3..45cebac 100644
--- a/gn/shared_sources.gni
+++ b/gn/shared_sources.gni
@@ -32,5 +32,4 @@
 # become 'permanent', they should be moved into Chrome's skia build file.
 skia_for_chromium_defines = [
   "SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS",
-  "SK_SUPPORT_LEGACY_DOCUMENT_FACTORY",
 ]
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index 27144a0..3b5a3fb 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -17,10 +17,6 @@
 class SkWStream;
 struct SkRect;
 
-#ifdef SK_BUILD_FOR_WIN
-struct IXpsOMObjectFactory;
-#endif
-
 /** SK_ScalarDefaultDPI is 72 dots per inch. */
 static constexpr SkScalar SK_ScalarDefaultRasterDPI = 72.0f;
 
@@ -37,122 +33,7 @@
 class SK_API SkDocument : public SkRefCnt {
 public:
 #ifdef SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
-    struct OptionalTimestamp {
-        SkTime::DateTime fDateTime;
-        bool fEnabled;
-        OptionalTimestamp() : fEnabled(false) {}
-    };
-
-    /**
-     *  Optional metadata to be passed into the PDF factory function.
-     */
-    struct PDFMetadata {
-        /**
-         * The document's title.
-         */
-        SkString fTitle;
-        /**
-         * The name of the person who created the document.
-         */
-        SkString fAuthor;
-        /**
-         * The subject of the document.
-         */
-        SkString fSubject;
-        /**
-         * Keywords associated with the document.  Commas may be used
-         * to delineate keywords within the string.
-         */
-        SkString fKeywords;
-        /**
-         * If the document was converted to PDF from another format,
-         * the name of the conforming product that created the
-         * original document from which it was converted.
-         */
-        SkString fCreator;
-        /**
-         * The product that is converting this document to PDF.
-         *
-         * Leave fProducer empty to get the default, correct value.
-         */
-        SkString fProducer;
-        /**
-         * The date and time the document was created.
-         */
-        OptionalTimestamp fCreation;
-        /**
-         * The date and time the document was most recently modified.
-         */
-        OptionalTimestamp fModified;
-
-        /** The DPI (pixels-per-inch) at which features without
-         *  native PDF support will be rasterized (e.g. draw image
-         *  with perspective, draw text with perspective, ...)  A
-         *  larger DPI would create a PDF that reflects the
-         *  original intent with better fidelity, but it can make
-         *  for larger PDF files too, which would use more memory
-         *  while rendering, and it would be slower to be processed
-         *  or sent online or to printer.
-         */
-        SkScalar fRasterDPI = SK_ScalarDefaultRasterDPI;
-
-        /** If true, include XMP metadata, a document UUID, and sRGB output intent information.
-         *  This adds length to the document and makes it non-reproducable, but are necessary
-         *  features for PDF/A-2b conformance
-         */
-        bool fPDFA = false;
-
-        /**
-         *  Encoding quality controls the trade-off between size and quality. By default this is
-         *  set to 101 percent, which corresponds to lossless encoding. If this value is set to
-         *  a value <= 100, and the image is opaque, it will be encoded (using JPEG) with that
-         *  quality setting.
-         */
-        int fEncodingQuality = 101;
-    };
-
-    /**
-     *  Create a PDF-backed document, writing the results into a
-     *  SkWStream.
-     *
-     *  PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm.
-     *
-     *  @param stream A PDF document will be written to this stream.  The document may write
-     *         to the stream at anytime during its lifetime, until either close() is
-     *         called or the document is deleted.
-     *  @param metadata a PDFmetadata object.  Any fields may be left empty.
-     *
-     *  @returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument.
-     */
-    static sk_sp<SkDocument> MakePDF(SkWStream* stream, const PDFMetadata& metadata);
     static sk_sp<SkDocument> MakePDF(SkWStream* stream);
-
-#ifdef SK_BUILD_FOR_WIN
-    /**
-     *  Create a XPS-backed document, writing the results into the stream.
-     *
-     *  @param stream A XPS document will be written to this stream.  The
-     *                document may write to the stream at anytime during its
-     *                lifetime, until either close() or abort() are called or
-     *                the document is deleted.
-     *  @param xpsFactory A pointer to a COM XPS factory.  Must be non-null.
-     *                    The document will take a ref to the factory. See
-     *                    dm/DMSrcSink.cpp for an example.
-     *  @param dpi The DPI (pixels-per-inch) at which features without
-     *             native XPS support will be rasterized (e.g. draw image
-     *             with perspective, draw text with perspective, ...)  A
-     *             larger DPI would create a XPS that reflects the
-     *             original intent with better fidelity, but it can make
-     *             for larger XPS files too, which would use more memory
-     *             while rendering, and it would be slower to be processed
-     *             or sent online or to printer.
-     *
-     *  @returns nullptr if XPS is not supported.
-     */
-    static sk_sp<SkDocument> MakeXPS(SkWStream* stream,
-                                     IXpsOMObjectFactory* xpsFactory,
-                                     SkScalar dpi = SK_ScalarDefaultRasterDPI);
-#endif  // SK_BUILD_FOR_WIN
 #endif  // SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
 
     /**
diff --git a/public.bzl b/public.bzl
index df4700a..2c8b6ea 100644
--- a/public.bzl
+++ b/public.bzl
@@ -613,8 +613,6 @@
         "SK_JUMPER_DISABLE_8BIT",
         # JPEG is in codec_limited
         "SK_HAS_JPEG_LIBRARY",
-        # remove once we've fixed call-sites
-        "SK_SUPPORT_LEGACY_DOCUMENT_FACTORY",
     ] + skia_select(
         os_conditions,
         [
diff --git a/src/pdf/SkDocument_PDF_None.cpp b/src/pdf/SkDocument_PDF_None.cpp
index 16f9947..eb5067c 100644
--- a/src/pdf/SkDocument_PDF_None.cpp
+++ b/src/pdf/SkDocument_PDF_None.cpp
@@ -8,10 +8,6 @@
 #include "SkPDFDocument.h"
 
 #ifdef SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
-sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, const PDFMetadata& metadata) {
-    return nullptr;
-}
-
 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream) {
     return nullptr;
 }
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 974c681..4694577 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -468,22 +468,6 @@
 }
 
 #ifdef SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
-sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, const PDFMetadata& metadata) {
-    SkPDF::Metadata meta;
-    meta.fTitle           = metadata.fTitle;
-    meta.fAuthor          = metadata.fAuthor;
-    meta.fSubject         = metadata.fSubject;
-    meta.fKeywords        = metadata.fKeywords;
-    meta.fCreator         = metadata.fCreator;
-    meta.fProducer        = metadata.fProducer;
-    meta.fRasterDPI       = SkTMax(metadata.fRasterDPI, 0.0f);
-    meta.fPDFA            = metadata.fPDFA;
-    meta.fEncodingQuality = SkTMax(metadata.fEncodingQuality, 0);
-    if (metadata.fCreation.fEnabled) { meta.fCreation = metadata.fCreation.fDateTime; }
-    if (metadata.fModified.fEnabled) { meta.fModified = metadata.fModified.fDateTime; }
-    return stream ? sk_make_sp<SkPDFDocument>(stream, std::move(meta)) : nullptr;
-}
-
 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream) {
     return SkPDF::MakeDocument(stream, SkPDF::Metadata());
 }
diff --git a/src/xps/SkXPSDocument.cpp b/src/xps/SkXPSDocument.cpp
index e594038..a8785a0 100644
--- a/src/xps/SkXPSDocument.cpp
+++ b/src/xps/SkXPSDocument.cpp
@@ -84,11 +84,4 @@
            ? sk_make_sp<SkXPSDocument>(stream, dpi, std::move(factory))
            : nullptr;
 }
-#ifdef SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
-sk_sp<SkDocument> SkDocument::MakeXPS(SkWStream* stream,
-                                      IXpsOMObjectFactory* factoryPtr,
-                                      SkScalar dpi) {
-    return SkXPS::MakeDocument(stream, factoryPtr, dpi);
-}
-#endif  // SK_SUPPORT_LEGACY_DOCUMENT_FACTORY
 #endif  // defined(SK_BUILD_FOR_WIN)