Merge to XFA: Move lcms2 into third_party

Original Review URL: https://codereview.chromium.org/1181943008.
TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1187273006.
diff --git a/BUILD.gn b/BUILD.gn
index ede37b4..adabb16 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -314,6 +314,9 @@
 }
 
 static_library("fxcodec") {
+  deps = [
+    "third_party:fx_lcms2",
+  ]
   sources = [
     "core/include/fxcodec/fx_codec.h",
     "core/include/fxcodec/fx_codec_def.h",
@@ -452,31 +455,8 @@
     "core/src/fxcodec/jbig2/JBig2_SymbolDict.h",
     "core/src/fxcodec/lbmp/fx_bmp.cpp",
     "core/src/fxcodec/lbmp/fx_bmp.h",
-    "core/src/fxcodec/lcms2/src/fx_cmscam02.c",
-    "core/src/fxcodec/lcms2/src/fx_cmscgats.c",
-    "core/src/fxcodec/lcms2/src/fx_cmscnvrt.c",
-    "core/src/fxcodec/lcms2/src/fx_cmserr.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsgamma.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsgmt.c",
-    "core/src/fxcodec/lcms2/src/fx_cmshalf.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsintrp.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsio0.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsio1.c",
-    "core/src/fxcodec/lcms2/src/fx_cmslut.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsmd5.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsmtrx.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsnamed.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsopt.c",
-    "core/src/fxcodec/lcms2/src/fx_cmspack.c",
-    "core/src/fxcodec/lcms2/src/fx_cmspcs.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsplugin.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsps2.c",
-    "core/src/fxcodec/lcms2/src/fx_cmssamp.c",
-    "core/src/fxcodec/lcms2/src/fx_cmssm.c",
-    "core/src/fxcodec/lcms2/src/fx_cmstypes.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsvirt.c",
-    "core/src/fxcodec/lcms2/src/fx_cmswtpnt.c",
-    "core/src/fxcodec/lcms2/src/fx_cmsxform.c",
+    "core/src/fxcodec/lcms2/fx_lcms2.h",
+    "core/src/fxcodec/lcms2/fx_lcms2_plugin.h",
     "core/src/fxcodec/lgif/fx_gif.cpp",
     "core/src/fxcodec/lgif/fx_gif.h",
     "core/src/fxcodec/libjpeg/cderror.h",
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index 3b3b54b..f33d085 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -5,8 +5,9 @@
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
 #include "../../../include/fxcodec/fx_codec.h"
+#include "../lcms2/fx_lcms2.h"
 #include "codec_int.h"
-#include "../lcms2/include/fx_lcms2.h"
+
 const FX_DWORD N_COMPONENT_LAB = 3;
 const FX_DWORD N_COMPONENT_GRAY = 1;
 const FX_DWORD N_COMPONENT_RGB = 3;
diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
index ce82960..4457f18 100644
--- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -8,9 +8,9 @@
 #include <limits>
 
 #include "../../../include/fxcodec/fx_codec.h"
-#include "codec_int.h"
 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h"
-#include "../lcms2/include/fx_lcms2.h"
+#include "../lcms2/fx_lcms2.h"
+#include "codec_int.h"
 
 static void fx_error_callback(const char *msg, void *client_data)
 {
diff --git a/core/src/fxcodec/lcms2/include/fx_lcms2.h b/core/src/fxcodec/lcms2/fx_lcms2.h
similarity index 86%
rename from core/src/fxcodec/lcms2/include/fx_lcms2.h
rename to core/src/fxcodec/lcms2/fx_lcms2.h
index ca1ed2a..86b4fad 100644
--- a/core/src/fxcodec/lcms2/include/fx_lcms2.h
+++ b/core/src/fxcodec/lcms2/fx_lcms2.h
@@ -7,6 +7,6 @@
 #ifndef CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_H_
 #define CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_H_
 
-#include "../lcms2-2.6/include/lcms2.h"
+#include "../../../../third_party/lcms2-2.6/include/lcms2.h"
 
 #endif  // CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_H_
diff --git a/core/src/fxcodec/lcms2/include/fx_lcms2_plugin.h b/core/src/fxcodec/lcms2/fx_lcms2_plugin.h
similarity index 85%
rename from core/src/fxcodec/lcms2/include/fx_lcms2_plugin.h
rename to core/src/fxcodec/lcms2/fx_lcms2_plugin.h
index 92fd8a6..86b722d 100644
--- a/core/src/fxcodec/lcms2/include/fx_lcms2_plugin.h
+++ b/core/src/fxcodec/lcms2/fx_lcms2_plugin.h
@@ -7,6 +7,6 @@
 #ifndef CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_PLUGIN_H_
 #define CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_PLUGIN_H_
 
-#include "../lcms2-2.6/include/lcms2_plugin.h"
+#include "../../../../third_party/lcms2-2.6/include/lcms2_plugin.h"
 
 #endif  // CORE_SRC_FXCODEC_LCMS2_INCLUDE_FX_LCMS2_PLUGIN_H_
diff --git a/core/src/fxcodec/lcms2/src/fx_cmscam02.c b/core/src/fxcodec/lcms2/src/fx_cmscam02.c
deleted file mode 100644
index 3268424..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmscam02.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmscam02.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmscgats.c b/core/src/fxcodec/lcms2/src/fx_cmscgats.c
deleted file mode 100644
index 9e00fe6..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmscgats.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmscgats.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmscnvrt.c b/core/src/fxcodec/lcms2/src/fx_cmscnvrt.c
deleted file mode 100644
index 9b9eb99..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmscnvrt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmscnvrt.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmserr.c b/core/src/fxcodec/lcms2/src/fx_cmserr.c
deleted file mode 100644
index 27d0696..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmserr.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmserr.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsgamma.c b/core/src/fxcodec/lcms2/src/fx_cmsgamma.c
deleted file mode 100644
index 9936c62..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsgamma.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsgamma.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsgmt.c b/core/src/fxcodec/lcms2/src/fx_cmsgmt.c
deleted file mode 100644
index dfe4cc8..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsgmt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsgmt.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmshalf.c b/core/src/fxcodec/lcms2/src/fx_cmshalf.c
deleted file mode 100644
index 9c7e07c..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmshalf.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmshalf.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsintrp.c b/core/src/fxcodec/lcms2/src/fx_cmsintrp.c
deleted file mode 100644
index 8eacd55..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsintrp.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsintrp.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsio0.c b/core/src/fxcodec/lcms2/src/fx_cmsio0.c
deleted file mode 100644
index a4aed23..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsio0.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsio0.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsio1.c b/core/src/fxcodec/lcms2/src/fx_cmsio1.c
deleted file mode 100644
index 34ce927..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsio1.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsio1.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmslut.c b/core/src/fxcodec/lcms2/src/fx_cmslut.c
deleted file mode 100644
index d032e3b..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmslut.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmslut.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsmd5.c b/core/src/fxcodec/lcms2/src/fx_cmsmd5.c
deleted file mode 100644
index 028db4a..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsmd5.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsmd5.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsmtrx.c b/core/src/fxcodec/lcms2/src/fx_cmsmtrx.c
deleted file mode 100644
index ad04dcc..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsmtrx.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsmtrx.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsnamed.c b/core/src/fxcodec/lcms2/src/fx_cmsnamed.c
deleted file mode 100644
index 93a0132..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsnamed.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsnamed.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsopt.c b/core/src/fxcodec/lcms2/src/fx_cmsopt.c
deleted file mode 100644
index e16c735..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsopt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsopt.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmspack.c b/core/src/fxcodec/lcms2/src/fx_cmspack.c
deleted file mode 100644
index d125d33..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmspack.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmspack.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmspcs.c b/core/src/fxcodec/lcms2/src/fx_cmspcs.c
deleted file mode 100644
index 2a9d6dd..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmspcs.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmspcs.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsplugin.c b/core/src/fxcodec/lcms2/src/fx_cmsplugin.c
deleted file mode 100644
index ab7e6c3..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsplugin.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsplugin.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsps2.c b/core/src/fxcodec/lcms2/src/fx_cmsps2.c
deleted file mode 100644
index b6a1ea9..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsps2.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsps2.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmssamp.c b/core/src/fxcodec/lcms2/src/fx_cmssamp.c
deleted file mode 100644
index 5e5c031..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmssamp.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmssamp.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmssm.c b/core/src/fxcodec/lcms2/src/fx_cmssm.c
deleted file mode 100644
index b8c7160..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmssm.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmssm.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmstypes.c b/core/src/fxcodec/lcms2/src/fx_cmstypes.c
deleted file mode 100644
index cf64a61..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmstypes.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmstypes.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsvirt.c b/core/src/fxcodec/lcms2/src/fx_cmsvirt.c
deleted file mode 100644
index cc60d1f..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsvirt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsvirt.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmswtpnt.c b/core/src/fxcodec/lcms2/src/fx_cmswtpnt.c
deleted file mode 100644
index d46c60a..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmswtpnt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmswtpnt.c"
diff --git a/core/src/fxcodec/lcms2/src/fx_cmsxform.c b/core/src/fxcodec/lcms2/src/fx_cmsxform.c
deleted file mode 100644
index e8cd83a..0000000
--- a/core/src/fxcodec/lcms2/src/fx_cmsxform.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../lcms2-2.6/src/cmsxform.c"
diff --git a/pdfium.gyp b/pdfium.gyp
index 6585adf..8a4fb0b 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -328,16 +328,10 @@
     {
       'target_name': 'fxcodec',
       'type': 'static_library',
-      'include_dirs': [
+      'dependencies': [
+        'third_party/third_party.gyp:fx_lcms2',
       ],
       'ldflags': [ '-L<(PRODUCT_DIR)',],
-      'msvs_settings': {
-        'VCCLCompilerTool': {
-          # Unresolved warnings in fx_codec_jpx_opj.cpp
-          # https://code.google.com/p/pdfium/issues/detail?id=100
-          'WarnAsError': 'false',
-        },
-      },
       'sources': [
         'core/include/fxcodec/fx_codec.h',
         'core/include/fxcodec/fx_codec_def.h',
@@ -477,31 +471,8 @@
         'core/src/fxcodec/jbig2/JBig2_SymbolDict.h',
         'core/src/fxcodec/lbmp/fx_bmp.cpp',
         'core/src/fxcodec/lbmp/fx_bmp.h',
-        'core/src/fxcodec/lcms2/src/fx_cmscam02.c',
-        'core/src/fxcodec/lcms2/src/fx_cmscgats.c',
-        'core/src/fxcodec/lcms2/src/fx_cmscnvrt.c',
-        'core/src/fxcodec/lcms2/src/fx_cmserr.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsgamma.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsgmt.c',
-        'core/src/fxcodec/lcms2/src/fx_cmshalf.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsintrp.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsio0.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsio1.c',
-        'core/src/fxcodec/lcms2/src/fx_cmslut.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsmd5.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsmtrx.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsnamed.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsopt.c',
-        'core/src/fxcodec/lcms2/src/fx_cmspack.c',
-        'core/src/fxcodec/lcms2/src/fx_cmspcs.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsplugin.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsps2.c',
-        'core/src/fxcodec/lcms2/src/fx_cmssamp.c',
-        'core/src/fxcodec/lcms2/src/fx_cmssm.c',
-        'core/src/fxcodec/lcms2/src/fx_cmstypes.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsvirt.c',
-        'core/src/fxcodec/lcms2/src/fx_cmswtpnt.c',
-        'core/src/fxcodec/lcms2/src/fx_cmsxform.c',
+        'core/src/fxcodec/lcms2/fx_lcms2.h',
+        'core/src/fxcodec/lcms2/fx_lcms2_plugin.h',
         'core/src/fxcodec/lgif/fx_gif.cpp',
         'core/src/fxcodec/lgif/fx_gif.h',
         'core/src/fxcodec/libjpeg/cderror.h',
@@ -560,6 +531,13 @@
         'core/src/fxcodec/libjpeg/makefile',
         'core/src/fxcodec/libjpeg/transupp.h',
       ],
+      'msvs_settings': {
+        'VCCLCompilerTool': {
+          # Unresolved warnings in fx_codec_jpx_opj.cpp
+          # https://code.google.com/p/pdfium/issues/detail?id=100
+          'WarnAsError': 'false',
+        },
+      },
       'conditions': [
         ['os_posix==1', {
           # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 9353b11..f5f0626 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -30,31 +30,6 @@
   ]
 }
 
-source_set("fx_agg") {
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    "//build/config/compiler:no_chromium_code",
-    "//third_party/pdfium:pdfium_config",
-  ]
-  sources = [
-    "agg23/agg_basics.h",
-    "agg23/agg_clip_liang_barsky.h",
-    "agg23/agg_conv_dash.h",
-    "agg23/agg_conv_stroke.h",
-    "agg23/agg_curves.cpp",
-    "agg23/agg_curves.h",
-    "agg23/agg_path_storage.cpp",
-    "agg23/agg_path_storage.h",
-    "agg23/agg_rasterizer_scanline_aa.cpp",
-    "agg23/agg_rasterizer_scanline_aa.h",
-    "agg23/agg_renderer_scanline.h",
-    "agg23/agg_rendering_buffer.h",
-    "agg23/agg_scanline_u.h",
-    "agg23/agg_vcgen_dash.cpp",
-    "agg23/agg_vcgen_stroke.cpp",
-  ]
-}
-
 source_set("freetype") {
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
@@ -94,6 +69,68 @@
   ]
 }
 
+source_set("fx_agg") {
+  configs -= [ "//build/config/compiler:chromium_code" ]
+  configs += [
+    "//build/config/compiler:no_chromium_code",
+    "//third_party/pdfium:pdfium_config",
+  ]
+  sources = [
+    "agg23/agg_basics.h",
+    "agg23/agg_clip_liang_barsky.h",
+    "agg23/agg_conv_dash.h",
+    "agg23/agg_conv_stroke.h",
+    "agg23/agg_curves.cpp",
+    "agg23/agg_curves.h",
+    "agg23/agg_path_storage.cpp",
+    "agg23/agg_path_storage.h",
+    "agg23/agg_rasterizer_scanline_aa.cpp",
+    "agg23/agg_rasterizer_scanline_aa.h",
+    "agg23/agg_renderer_scanline.h",
+    "agg23/agg_rendering_buffer.h",
+    "agg23/agg_scanline_u.h",
+    "agg23/agg_vcgen_dash.cpp",
+    "agg23/agg_vcgen_stroke.cpp",
+  ]
+}
+
+source_set("fx_lcms2") {
+  configs -= [ "//build/config/compiler:chromium_code" ]
+  configs += [
+    "//build/config/compiler:no_chromium_code",
+    "//third_party/pdfium:pdfium_config",
+  ]
+  sources = [
+    "lcms2-2.6/include/lcms2.h",
+    "lcms2-2.6/include/lcms2_plugin.h",
+    "lcms2-2.6/src/cmscam02.c",
+    "lcms2-2.6/src/cmscgats.c",
+    "lcms2-2.6/src/cmscnvrt.c",
+    "lcms2-2.6/src/cmserr.c",
+    "lcms2-2.6/src/cmsgamma.c",
+    "lcms2-2.6/src/cmsgmt.c",
+    "lcms2-2.6/src/cmshalf.c",
+    "lcms2-2.6/src/cmsintrp.c",
+    "lcms2-2.6/src/cmsio0.c",
+    "lcms2-2.6/src/cmsio1.c",
+    "lcms2-2.6/src/cmslut.c",
+    "lcms2-2.6/src/cmsmd5.c",
+    "lcms2-2.6/src/cmsmtrx.c",
+    "lcms2-2.6/src/cmsnamed.c",
+    "lcms2-2.6/src/cmsopt.c",
+    "lcms2-2.6/src/cmspack.c",
+    "lcms2-2.6/src/cmspcs.c",
+    "lcms2-2.6/src/cmsplugin.c",
+    "lcms2-2.6/src/cmsps2.c",
+    "lcms2-2.6/src/cmssamp.c",
+    "lcms2-2.6/src/cmssm.c",
+    "lcms2-2.6/src/cmstypes.c",
+    "lcms2-2.6/src/cmsvirt.c",
+    "lcms2-2.6/src/cmswtpnt.c",
+    "lcms2-2.6/src/cmsxform.c",
+  ]
+}
+
 component("pdfium_base") {
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
@@ -111,4 +148,3 @@
     "base/template_util.h",
   ]
 }
-
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/include/lcms2.h b/third_party/lcms2-2.6/include/lcms2.h
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/include/lcms2.h
rename to third_party/lcms2-2.6/include/lcms2.h
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/include/lcms2_plugin.h b/third_party/lcms2-2.6/include/lcms2_plugin.h
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/include/lcms2_plugin.h
rename to third_party/lcms2-2.6/include/lcms2_plugin.h
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmscam02.c b/third_party/lcms2-2.6/src/cmscam02.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmscam02.c
rename to third_party/lcms2-2.6/src/cmscam02.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmscgats.c b/third_party/lcms2-2.6/src/cmscgats.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmscgats.c
rename to third_party/lcms2-2.6/src/cmscgats.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmscnvrt.c b/third_party/lcms2-2.6/src/cmscnvrt.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmscnvrt.c
rename to third_party/lcms2-2.6/src/cmscnvrt.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmserr.c b/third_party/lcms2-2.6/src/cmserr.c
similarity index 99%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmserr.c
rename to third_party/lcms2-2.6/src/cmserr.c
index a32b6e2..743b4f5 100644
--- a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmserr.c
+++ b/third_party/lcms2-2.6/src/cmserr.c
@@ -251,8 +251,8 @@
     return TRUE;
 }
 #else
-#include "../../../../../include/fxcrt/fx_system.h"
-#include "../../../../../include/fxcrt/fx_memory.h"
+#include "../../../core/include/fxcrt/fx_memory.h"
+#include "../../../core/include/fxcrt/fx_system.h"
 
 cmsBool  _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plugin)
 {
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsgamma.c b/third_party/lcms2-2.6/src/cmsgamma.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsgamma.c
rename to third_party/lcms2-2.6/src/cmsgamma.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsgmt.c b/third_party/lcms2-2.6/src/cmsgmt.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsgmt.c
rename to third_party/lcms2-2.6/src/cmsgmt.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmshalf.c b/third_party/lcms2-2.6/src/cmshalf.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmshalf.c
rename to third_party/lcms2-2.6/src/cmshalf.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsintrp.c b/third_party/lcms2-2.6/src/cmsintrp.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsintrp.c
rename to third_party/lcms2-2.6/src/cmsintrp.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsio0.c b/third_party/lcms2-2.6/src/cmsio0.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsio0.c
rename to third_party/lcms2-2.6/src/cmsio0.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsio1.c b/third_party/lcms2-2.6/src/cmsio1.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsio1.c
rename to third_party/lcms2-2.6/src/cmsio1.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmslut.c b/third_party/lcms2-2.6/src/cmslut.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmslut.c
rename to third_party/lcms2-2.6/src/cmslut.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsmd5.c b/third_party/lcms2-2.6/src/cmsmd5.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsmd5.c
rename to third_party/lcms2-2.6/src/cmsmd5.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsmtrx.c b/third_party/lcms2-2.6/src/cmsmtrx.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsmtrx.c
rename to third_party/lcms2-2.6/src/cmsmtrx.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsnamed.c b/third_party/lcms2-2.6/src/cmsnamed.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsnamed.c
rename to third_party/lcms2-2.6/src/cmsnamed.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsopt.c b/third_party/lcms2-2.6/src/cmsopt.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsopt.c
rename to third_party/lcms2-2.6/src/cmsopt.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmspack.c b/third_party/lcms2-2.6/src/cmspack.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmspack.c
rename to third_party/lcms2-2.6/src/cmspack.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmspcs.c b/third_party/lcms2-2.6/src/cmspcs.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmspcs.c
rename to third_party/lcms2-2.6/src/cmspcs.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsplugin.c b/third_party/lcms2-2.6/src/cmsplugin.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsplugin.c
rename to third_party/lcms2-2.6/src/cmsplugin.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsps2.c b/third_party/lcms2-2.6/src/cmsps2.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsps2.c
rename to third_party/lcms2-2.6/src/cmsps2.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmssamp.c b/third_party/lcms2-2.6/src/cmssamp.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmssamp.c
rename to third_party/lcms2-2.6/src/cmssamp.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmssm.c b/third_party/lcms2-2.6/src/cmssm.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmssm.c
rename to third_party/lcms2-2.6/src/cmssm.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmstypes.c b/third_party/lcms2-2.6/src/cmstypes.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmstypes.c
rename to third_party/lcms2-2.6/src/cmstypes.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsvirt.c b/third_party/lcms2-2.6/src/cmsvirt.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsvirt.c
rename to third_party/lcms2-2.6/src/cmsvirt.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmswtpnt.c b/third_party/lcms2-2.6/src/cmswtpnt.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmswtpnt.c
rename to third_party/lcms2-2.6/src/cmswtpnt.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/cmsxform.c b/third_party/lcms2-2.6/src/cmsxform.c
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/cmsxform.c
rename to third_party/lcms2-2.6/src/cmsxform.c
diff --git a/core/src/fxcodec/lcms2/lcms2-2.6/src/lcms2_internal.h b/third_party/lcms2-2.6/src/lcms2_internal.h
similarity index 100%
rename from core/src/fxcodec/lcms2/lcms2-2.6/src/lcms2_internal.h
rename to third_party/lcms2-2.6/src/lcms2_internal.h
diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp
index 8538001..5244162 100644
--- a/third_party/third_party.gyp
+++ b/third_party/third_party.gyp
@@ -21,33 +21,6 @@
       ],
     },
     {
-      'target_name': 'fx_agg',
-      'type': 'static_library',
-      'sources': [
-        'agg23/agg_basics.h',
-        'agg23/agg_clip_liang_barsky.h',
-        'agg23/agg_conv_dash.h',
-        'agg23/agg_conv_stroke.h',
-        'agg23/agg_curves.cpp',
-        'agg23/agg_curves.h',
-        'agg23/agg_path_storage.cpp',
-        'agg23/agg_path_storage.h',
-        'agg23/agg_rasterizer_scanline_aa.cpp',
-        'agg23/agg_rasterizer_scanline_aa.h',
-        'agg23/agg_renderer_scanline.h',
-        'agg23/agg_rendering_buffer.h',
-        'agg23/agg_scanline_u.h',
-        'agg23/agg_vcgen_dash.cpp',
-        'agg23/agg_vcgen_stroke.cpp',
-      ],
-      'conditions': [
-        ['os_posix==1', {
-          # library contains several enum vs non-enum conditionals.
-          'cflags': [ '-Wno-extra', ],
-        }],
-      ],
-    },
-    {
       'target_name': 'freetype',
       'type': 'static_library',
       'defines': [
@@ -88,6 +61,75 @@
       ],
     },
     {
+      'target_name': 'fx_agg',
+      'type': 'static_library',
+      'sources': [
+        'agg23/agg_basics.h',
+        'agg23/agg_clip_liang_barsky.h',
+        'agg23/agg_conv_dash.h',
+        'agg23/agg_conv_stroke.h',
+        'agg23/agg_curves.cpp',
+        'agg23/agg_curves.h',
+        'agg23/agg_path_storage.cpp',
+        'agg23/agg_path_storage.h',
+        'agg23/agg_rasterizer_scanline_aa.cpp',
+        'agg23/agg_rasterizer_scanline_aa.h',
+        'agg23/agg_renderer_scanline.h',
+        'agg23/agg_rendering_buffer.h',
+        'agg23/agg_scanline_u.h',
+        'agg23/agg_vcgen_dash.cpp',
+        'agg23/agg_vcgen_stroke.cpp',
+      ],
+      'conditions': [
+        ['os_posix==1', {
+          # library contains several enum vs non-enum conditionals.
+          'cflags': [ '-Wno-extra', ],
+        }],
+      ],
+    },
+    {
+      'target_name': 'fx_lcms2',
+      'type': 'static_library',
+      'sources': [
+        'lcms2-2.6/include/lcms2.h',
+        'lcms2-2.6/include/lcms2_plugin.h',
+        'lcms2-2.6/src/cmscam02.c',
+        'lcms2-2.6/src/cmscgats.c',
+        'lcms2-2.6/src/cmscnvrt.c',
+        'lcms2-2.6/src/cmserr.c',
+        'lcms2-2.6/src/cmsgamma.c',
+        'lcms2-2.6/src/cmsgmt.c',
+        'lcms2-2.6/src/cmshalf.c',
+        'lcms2-2.6/src/cmsintrp.c',
+        'lcms2-2.6/src/cmsio0.c',
+        'lcms2-2.6/src/cmsio1.c',
+        'lcms2-2.6/src/cmslut.c',
+        'lcms2-2.6/src/cmsmd5.c',
+        'lcms2-2.6/src/cmsmtrx.c',
+        'lcms2-2.6/src/cmsnamed.c',
+        'lcms2-2.6/src/cmsopt.c',
+        'lcms2-2.6/src/cmspack.c',
+        'lcms2-2.6/src/cmspcs.c',
+        'lcms2-2.6/src/cmsplugin.c',
+        'lcms2-2.6/src/cmsps2.c',
+        'lcms2-2.6/src/cmssamp.c',
+        'lcms2-2.6/src/cmssm.c',
+        'lcms2-2.6/src/cmstypes.c',
+        'lcms2-2.6/src/cmsvirt.c',
+        'lcms2-2.6/src/cmswtpnt.c',
+        'lcms2-2.6/src/cmsxform.c',
+      ],
+      'conditions': [
+        ['os_posix==1', {
+          'cflags': [
+            '-Wno-main',
+            '-Wno-missing-braces',
+            '-Wno-unused',
+          ],
+        }],
+      ],
+    },
+    {
       'target_name': 'pdfium_base',
       'type': 'none',
       'sources': [