Make concrete stream classes private to .cpp, part 3

Review-Url: https://codereview.chromium.org/2545953002
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 797c3e7..9c0411b 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -21,6 +21,22 @@
 #include "xfa/fxfa/xfa_ffwidgethandler.h"
 #include "xfa/fxfa/xfa_fontmgr.h"
 
+namespace {
+
+class CXFA_FileRead : public IFX_SeekableReadStream {
+ public:
+  explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
+  ~CXFA_FileRead() override;
+
+  // IFX_SeekableReadStream
+  FX_FILESIZE GetSize() override;
+  bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+  void Release() override;
+
+ private:
+  CFX_ObjectArray<CPDF_StreamAcc> m_Data;
+};
+
 CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) {
   for (CPDF_Stream* pStream : streams) {
     CPDF_StreamAcc& acc = m_Data.Add();
@@ -72,6 +88,13 @@
   delete this;
 }
 
+}  // namespace
+
+IFX_SeekableReadStream* MakeSeekableReadStream(
+    const std::vector<CPDF_Stream*>& streams) {
+  return new CXFA_FileRead(streams);
+}
+
 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
     : m_pProvider(pProvider),
       m_pWidgetMgrDelegate(nullptr),
diff --git a/xfa/fxfa/app/xfa_ffapp_unittest.cpp b/xfa/fxfa/app/xfa_ffapp_unittest.cpp
index b35780d..7a65dcc 100644
--- a/xfa/fxfa/app/xfa_ffapp_unittest.cpp
+++ b/xfa/fxfa/app/xfa_ffapp_unittest.cpp
@@ -13,12 +13,12 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/ptr_util.h"
 
-using UniqueFileRead =
-    std::unique_ptr<CXFA_FileRead, ReleaseDeleter<CXFA_FileRead>>;
+using UniqueFileRead = std::unique_ptr<IFX_SeekableReadStream,
+                                       ReleaseDeleter<IFX_SeekableReadStream>>;
 
 TEST(CXFAFileRead, NoStreams) {
   std::vector<CPDF_Stream*> streams;
-  UniqueFileRead fileread(new CXFA_FileRead(streams));
+  UniqueFileRead fileread(MakeSeekableReadStream(streams));
 
   uint8_t output_buffer[16];
   memset(output_buffer, 0xbd, sizeof(output_buffer));
@@ -30,7 +30,7 @@
   std::vector<CPDF_Stream*> streams;
   std::unique_ptr<CPDF_Stream> stream1 = pdfium::MakeUnique<CPDF_Stream>();
   streams.push_back(stream1.get());
-  UniqueFileRead fileread(new CXFA_FileRead(streams));
+  UniqueFileRead fileread(MakeSeekableReadStream(streams));
 
   uint8_t output_buffer[16];
   memset(output_buffer, 0xbd, sizeof(output_buffer));
@@ -55,7 +55,7 @@
   streams.push_back(stream1.get());
   streams.push_back(stream2.get());
   streams.push_back(stream3.get());
-  UniqueFileRead fileread(new CXFA_FileRead(streams));
+  UniqueFileRead fileread(MakeSeekableReadStream(streams));
 
   uint8_t output_buffer[16];
   memset(output_buffer, 0xbd, sizeof(output_buffer));
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index cf5b289..e719a41 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -326,7 +326,7 @@
   if (xfaStreams.empty())
     return false;
 
-  IFX_SeekableReadStream* pFileRead = new CXFA_FileRead(xfaStreams);
+  IFX_SeekableReadStream* pFileRead = MakeSeekableReadStream(xfaStreams);
   m_pPDFDoc = pPDFDoc;
   if (m_pStream) {
     m_pStream->Release();
diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h
index 6dbdb72..95013ef 100644
--- a/xfa/fxfa/xfa_ffapp.h
+++ b/xfa/fxfa/xfa_ffapp.h
@@ -24,19 +24,10 @@
 class IFWL_AdapterTimerMgr;
 class CFWL_WidgetMgrDelegate;
 
-class CXFA_FileRead : public IFX_SeekableReadStream {
- public:
-  explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
-  ~CXFA_FileRead() override;
-
-  // IFX_SeekableReadStream
-  FX_FILESIZE GetSize() override;
-  bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-  void Release() override;
-
- protected:
-  CFX_ObjectArray<CPDF_StreamAcc> m_Data;
-};
+// Layering prevents fxcrt from knowing about CPDF_Streams; this could go
+// in fpdfsdk, but it is XFA-Only.
+IFX_SeekableReadStream* MakeSeekableReadStream(
+    const std::vector<CPDF_Stream*>& streams);
 
 class CXFA_FFApp {
  public: