Isolate lcms2 usage to a few files.

Then set up the right dependencies for them.

BUG=chromium:765914

Change-Id: I036cd888c741927d5efe0d020c6676f169e7cbb1
Reviewed-on: https://pdfium-review.googlesource.com/14410
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 0d3e67b..9c8d221 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -672,6 +672,7 @@
   configs += [ ":pdfium_core_config" ]
   deps = [
     ":fxcrt",
+    "third_party:lcms2",
   ]
 }
 
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index c37b5a4..3e2b885 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -28,6 +28,7 @@
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
 #include "core/fpdfapi/parser/cpdf_string.h"
 #include "core/fpdfdoc/cpdf_action.h"
+#include "core/fxcodec/codec/ccodec_iccmodule.h"
 #include "core/fxcodec/fx_codec.h"
 #include "core/fxcrt/cfx_fixedbufgrow.h"
 #include "core/fxcrt/cfx_maybe_owned.h"
diff --git a/core/fpdfapi/page/cpdf_iccprofile.cpp b/core/fpdfapi/page/cpdf_iccprofile.cpp
index 0fa4be4..144f530 100644
--- a/core/fpdfapi/page/cpdf_iccprofile.cpp
+++ b/core/fpdfapi/page/cpdf_iccprofile.cpp
@@ -8,6 +8,7 @@
 
 #include "core/fpdfapi/cpdf_modulemgr.h"
 #include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fxcodec/codec/ccodec_iccmodule.h"
 
 namespace {
 
diff --git a/core/fpdfapi/page/cpdf_iccprofile.h b/core/fpdfapi/page/cpdf_iccprofile.h
index 156fb59..0226a56 100644
--- a/core/fpdfapi/page/cpdf_iccprofile.h
+++ b/core/fpdfapi/page/cpdf_iccprofile.h
@@ -9,10 +9,10 @@
 
 #include <memory>
 
-#include "core/fxcodec/codec/ccodec_iccmodule.h"
 #include "core/fxcrt/cfx_retain_ptr.h"
 #include "core/fxcrt/cfx_unowned_ptr.h"
 
+class CLcmsCmm;
 class CPDF_Stream;
 
 class CPDF_IccProfile : public CFX_Retainable {
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index b50c012..89c5123 100644
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -19,12 +19,6 @@
 #include "third_party/libopenjpeg20/openjpeg.h"
 #include "third_party/libopenjpeg20/opj_malloc.h"
 
-#if defined(USE_SYSTEM_LCMS2)
-#include <lcms2.h>
-#else
-#include "third_party/lcms/include/lcms2.h"
-#endif
-
 namespace {
 
 void fx_ignore_callback(const char* msg, void* client_data) {}
diff --git a/testing/libfuzzer/BUILD.gn b/testing/libfuzzer/BUILD.gn
index 6e61827..2952444 100644
--- a/testing/libfuzzer/BUILD.gn
+++ b/testing/libfuzzer/BUILD.gn
@@ -57,6 +57,9 @@
     deps = [
       "../..:pdfium",
     ]
+    if (defined(invoker.deps)) {
+      deps += invoker.deps
+    }
     testonly = true
     configs -= [ "//build/config/compiler:chromium_code" ]
     configs += [
@@ -152,6 +155,9 @@
 }
 
 pdfium_fuzzer("pdf_codec_icc_fuzzer") {
+  deps = [
+    "../../third_party/:lcms2",
+  ]
   sources = [
     "pdf_codec_icc_fuzzer.cc",
   ]