summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 23:22:28 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 23:22:28 +0000
commit33dc8fa07256578d33459d4433dbaf613dec62c7 (patch)
treedabcf73287957b753b2722c96d9945c60f5eb61b /o3d
parent7db104022c5d04b22473c8258fabdd6a12301242 (diff)
downloadchromium_src-33dc8fa07256578d33459d4433dbaf613dec62c7.zip
chromium_src-33dc8fa07256578d33459d4433dbaf613dec62c7.tar.gz
chromium_src-33dc8fa07256578d33459d4433dbaf613dec62c7.tar.bz2
Diabolic hackery to work around differing NPAPI headers and definitions between Chromium and O3D.
TEST=none BUG=none Review URL: http://codereview.chromium.org/242042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/build/common.gypi7
-rw-r--r--o3d/gpu_plugin/gpu_plugin.gyp15
-rw-r--r--o3d/gpu_plugin/np_utils/default_np_object.h4
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.cc1
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser.h4
-rw-r--r--o3d/gpu_plugin/np_utils/np_browser_stub.h2
-rw-r--r--o3d/gpu_plugin/np_utils/np_class.h3
-rw-r--r--o3d/gpu_plugin/np_utils/np_dispatcher.h3
-rw-r--r--o3d/gpu_plugin/np_utils/np_headers.h25
-rw-r--r--o3d/gpu_plugin/np_utils/np_object_pointer.h3
-rw-r--r--o3d/gpu_plugin/np_utils/np_plugin_object.h3
-rw-r--r--o3d/gpu_plugin/np_utils/np_plugin_object_factory.h4
-rw-r--r--o3d/gpu_plugin/np_utils/np_utils.cc2
-rw-r--r--o3d/gpu_plugin/np_utils/np_utils.h3
-rw-r--r--o3d/gpu_plugin/system_services/shared_memory_public.h4
15 files changed, 60 insertions, 23 deletions
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi
index 4faaa22..69c2081 100644
--- a/o3d/build/common.gypi
+++ b/o3d/build/common.gypi
@@ -43,6 +43,13 @@
],
},
'conditions' : [
+ ['o3d_in_chrome == 1',
+ {
+ 'defined': [
+ 'O3D_IN_CHROME',
+ ],
+ },
+ ],
['OS == "win"',
{
'variables': {
diff --git a/o3d/gpu_plugin/gpu_plugin.gyp b/o3d/gpu_plugin/gpu_plugin.gyp
index 0276ee9..5402197 100644
--- a/o3d/gpu_plugin/gpu_plugin.gyp
+++ b/o3d/gpu_plugin/gpu_plugin.gyp
@@ -15,8 +15,20 @@
],
'include_dirs': [
'../..',
- '../../third_party/npapi',
+
+ # Chrome NPAPI header dir appears before the O3D one so it takes
+ # priority. TODO(apatrick): one set of NPAPI headers.
+ '../../third_party/npapi/bindings',
+ '../../third_party/npapi/include',
],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ # Chrome NPAPI header dir appears before the O3D one so it takes
+ # priority. TODO(apatrick): one set of NPAPI headers.
+ '../../third_party/npapi/bindings',
+ '../../third_party/npapi/include',
+ ],
+ }, # 'direct_dependent_settings'
'sources': [
'np_utils/default_np_object.h',
'np_utils/dynamic_np_object.cc',
@@ -30,6 +42,7 @@
'np_utils/np_dispatcher.cc',
'np_utils/np_dispatcher.h',
'np_utils/np_dispatcher_specializations.h',
+ 'np_utils/np_headers.h',
'np_utils/np_object_mock.h',
'np_utils/np_object_pointer.h',
'np_utils/np_plugin_object.h',
diff --git a/o3d/gpu_plugin/np_utils/default_np_object.h b/o3d/gpu_plugin/np_utils/default_np_object.h
index 4228fcd..4c50949 100644
--- a/o3d/gpu_plugin/np_utils/default_np_object.h
+++ b/o3d/gpu_plugin/np_utils/default_np_object.h
@@ -5,8 +5,8 @@
#ifndef O3D_GPU_PLUGIN_NP_UTILS_DEFAULT_NP_OBJECT_H_
#define O3D_GPU_PLUGIN_NP_UTILS_DEFAULT_NP_OBJECT_H_
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "base/basictypes.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_browser.cc b/o3d/gpu_plugin/np_utils/np_browser.cc
index a1eda6d..c86104d 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.cc
+++ b/o3d/gpu_plugin/np_utils/np_browser.cc
@@ -4,7 +4,6 @@
#include "o3d/gpu_plugin/np_utils/np_browser.h"
#include "base/logging.h"
-#include "webkit/glue/plugins/nphostapi.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_browser.h b/o3d/gpu_plugin/np_utils/np_browser.h
index 3f11fa1..dc50d81 100644
--- a/o3d/gpu_plugin/np_utils/np_browser.h
+++ b/o3d/gpu_plugin/np_utils/np_browser.h
@@ -5,8 +5,8 @@
#ifndef O3D_GPU_PLUGIN_NP_UTILS_NP_BROWSER_H_
#define O3D_GPU_PLUGIN_NP_UTILS_NP_BROWSER_H_
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "base/basictypes.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
typedef struct _NPNetscapeFuncs NPNetscapeFuncs;
diff --git a/o3d/gpu_plugin/np_utils/np_browser_stub.h b/o3d/gpu_plugin/np_utils/np_browser_stub.h
index 4fd8767..b5c9cff 100644
--- a/o3d/gpu_plugin/np_utils/np_browser_stub.h
+++ b/o3d/gpu_plugin/np_utils/np_browser_stub.h
@@ -9,8 +9,6 @@
#include <string>
#include "o3d/gpu_plugin/np_utils/np_browser.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_class.h b/o3d/gpu_plugin/np_utils/np_class.h
index cdf19d5..76f0562 100644
--- a/o3d/gpu_plugin/np_utils/np_class.h
+++ b/o3d/gpu_plugin/np_utils/np_class.h
@@ -6,8 +6,7 @@
#define O3D_GPU_PLUGIN_NP_UTILS_NP_CLASS_H_
#include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
// This file implements NPGetClass<T>. This function returns an NPClass
// that can be used to instantiate an NPObject subclass T. The NPClass
diff --git a/o3d/gpu_plugin/np_utils/np_dispatcher.h b/o3d/gpu_plugin/np_utils/np_dispatcher.h
index 023fcc2..ebfbfdc 100644
--- a/o3d/gpu_plugin/np_utils/np_dispatcher.h
+++ b/o3d/gpu_plugin/np_utils/np_dispatcher.h
@@ -8,8 +8,7 @@
#include <string>
#include "o3d/gpu_plugin/np_utils/np_utils.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
// Dispatchers make regular member functions available as NPObject methods.
// Usage:
diff --git a/o3d/gpu_plugin/np_utils/np_headers.h b/o3d/gpu_plugin/np_utils/np_headers.h
new file mode 100644
index 0000000..49e496c
--- /dev/null
+++ b/o3d/gpu_plugin/np_utils/np_headers.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2006-2008 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.
+
+#ifndef O3D_GPU_PLUGIN_NP_UTILS_NP_HEADERS_H_
+#define O3D_GPU_PLUGIN_NP_UTILS_NP_HEADERS_H_
+
+// This is a hack to work around the differing definitions of NPString in the
+// Chrome and O3D NPAPI headers.
+#define utf8characters UTF8Characters
+#define utf8length UTF8Length
+// Deliberately not including a directory name because Chromium and O3D put
+// these headers in different directories.
+#include "npapi.h"
+#include "npruntime.h"
+#undef utf8characters
+#undef utf8length
+
+#if defined(O3D_IN_CHROME)
+#include "webkit/glue/plugins/nphostapi.h"
+#else
+#include "npupp.h"
+#endif
+
+#endif // O3D_GPU_PLUGIN_NP_UTILS_NP_HEADERS_H_
diff --git a/o3d/gpu_plugin/np_utils/np_object_pointer.h b/o3d/gpu_plugin/np_utils/np_object_pointer.h
index 4d687dc..98a82bd 100644
--- a/o3d/gpu_plugin/np_utils/np_object_pointer.h
+++ b/o3d/gpu_plugin/np_utils/np_object_pointer.h
@@ -7,8 +7,7 @@
#include "base/logging.h"
#include "o3d/gpu_plugin/np_utils/np_browser.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_plugin_object.h b/o3d/gpu_plugin/np_utils/np_plugin_object.h
index c87b6e1..f80b614 100644
--- a/o3d/gpu_plugin/np_utils/np_plugin_object.h
+++ b/o3d/gpu_plugin/np_utils/np_plugin_object.h
@@ -6,8 +6,7 @@
#define O3D_GPU_PLUGIN_NP_UTILS_NP_PLUGIN_OBJECT_H_
#include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_plugin_object_factory.h b/o3d/gpu_plugin/np_utils/np_plugin_object_factory.h
index 3671542..f9aeb5f 100644
--- a/o3d/gpu_plugin/np_utils/np_plugin_object_factory.h
+++ b/o3d/gpu_plugin/np_utils/np_plugin_object_factory.h
@@ -5,8 +5,8 @@
#ifndef O3D_GPU_PLUGIN_NP_UTILS_NP_PLUGIN_OBJECT_FACTORY_H_
#define O3D_GPU_PLUGIN_NP_UTILS_NP_PLUGIN_OBJECT_FACTORY_H_
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "base/basictypes.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_utils.cc b/o3d/gpu_plugin/np_utils/np_utils.cc
index 044dd37..01308b3 100644
--- a/o3d/gpu_plugin/np_utils/np_utils.cc
+++ b/o3d/gpu_plugin/np_utils/np_utils.cc
@@ -3,8 +3,6 @@
// found in the LICENSE file.
#include "o3d/gpu_plugin/np_utils/np_utils.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/np_utils/np_utils.h b/o3d/gpu_plugin/np_utils/np_utils.h
index 4aee86c..ffd7045 100644
--- a/o3d/gpu_plugin/np_utils/np_utils.h
+++ b/o3d/gpu_plugin/np_utils/np_utils.h
@@ -10,8 +10,7 @@
#include "o3d/gpu_plugin/np_utils/np_browser.h"
#include "o3d/gpu_plugin/np_utils/np_class.h"
#include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
+#include "o3d/gpu_plugin/np_utils/np_headers.h"
namespace o3d {
namespace gpu_plugin {
diff --git a/o3d/gpu_plugin/system_services/shared_memory_public.h b/o3d/gpu_plugin/system_services/shared_memory_public.h
index af994ef2..f6598ed 100644
--- a/o3d/gpu_plugin/system_services/shared_memory_public.h
+++ b/o3d/gpu_plugin/system_services/shared_memory_public.h
@@ -9,7 +9,9 @@
// mapped. Each process needs to separately map the object. It is safe to
// map an already mapped object.
-#include "third_party/npapi/bindings/npruntime.h"
+// Deliberately not including a directory name because Chromium and O3D put
+// these headers in different directories.
+#include "npruntime.h"
#if defined(__cplusplus)