summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 21:31:17 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 21:31:17 +0000
commitda81627a00f7e00f726448e132ddaddec769f9d4 (patch)
tree275046309e1c79c6fd559d590de7b5f83d273abd /content
parentc10b208557384ab926cfcef64cf02065e412d2ce (diff)
downloadchromium_src-da81627a00f7e00f726448e132ddaddec769f9d4.zip
chromium_src-da81627a00f7e00f726448e132ddaddec769f9d4.tar.gz
chromium_src-da81627a00f7e00f726448e132ddaddec769f9d4.tar.bz2
Refactor renderer<->plugin code out of content/common
Renderer and plugin processes establish a dedicated IPC channel and communicate with each other to manage NPObjects and NPN/NPP calls. The browser process never uses this channel or the associated code. The NPObject proxies depend on Blink to do element binding. This moves this code out of content_common into a new library content_child_common to avoid pulling these Blink dependencies into the browser process. BUG=237267 Review URL: https://chromiumcodereview.appspot.com/14905008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/content_message_generator.h1
-rw-r--r--content/common/content_param_traits.cc120
-rw-r--r--content/common/content_param_traits.h58
-rw-r--r--content/common/java_bridge_messages.h6
-rw-r--r--content/common/pepper_plugin_registry.cc1
-rw-r--r--content/common/plugin_message_generator.cc33
-rw-r--r--content/common/plugin_message_generator.h7
-rw-r--r--content/common/plugin_messages.h1
-rw-r--r--content/common/plugin_param_traits.cc133
-rw-r--r--content/common/plugin_param_traits.h83
-rw-r--r--content/content.gyp32
-rw-r--r--content/content_common.gypi16
-rw-r--r--content/content_common_plugin.gypi50
-rw-r--r--content/renderer/render_view_impl.cc6
14 files changed, 353 insertions, 194 deletions
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index e553480..2afd523 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -39,7 +39,6 @@
#include "content/common/mime_registry_messages.h"
#include "content/common/p2p_messages.h"
#include "content/common/pepper_messages.h"
-#include "content/common/plugin_messages.h"
#include "content/common/quota_messages.h"
#include "content/common/resource_messages.h"
#include "content/common/socket_stream_messages.h"
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc
index 63f8468..ad921d0 100644
--- a/content/common/content_param_traits.cc
+++ b/content/common/content_param_traits.cc
@@ -7,8 +7,6 @@
#include "base/string_number_conversions.h"
#include "net/base/ip_endpoint.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
-#include "webkit/glue/npruntime_util.h"
-#include "webkit/plugins/npapi/plugin_host.h"
#include "ui/base/range/range.h"
namespace {
@@ -30,31 +28,6 @@ int WebInputEventSizeForType(WebKit::WebInputEvent::Type type) {
} // namespace
-namespace content {
-
-NPIdentifier_Param::NPIdentifier_Param()
- : identifier() {
-}
-
-NPIdentifier_Param::~NPIdentifier_Param() {
-}
-
-NPVariant_Param::NPVariant_Param()
- : type(NPVARIANT_PARAM_VOID),
- bool_value(false),
- int_value(0),
- double_value(0),
- npobject_routing_id(-1) {
-}
-
-NPVariant_Param::~NPVariant_Param() {
-}
-
-} // namespace content
-
-using content::NPIdentifier_Param;
-using content::NPVariant_Param;
-
namespace IPC {
void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) {
@@ -76,99 +49,6 @@ void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
LogParam("IPEndPoint:" + p.ToString(), l);
}
-void ParamTraits<NPVariant_Param>::Write(Message* m, const param_type& p) {
- WriteParam(m, static_cast<int>(p.type));
- if (p.type == content::NPVARIANT_PARAM_BOOL) {
- WriteParam(m, p.bool_value);
- } else if (p.type == content::NPVARIANT_PARAM_INT) {
- WriteParam(m, p.int_value);
- } else if (p.type == content::NPVARIANT_PARAM_DOUBLE) {
- WriteParam(m, p.double_value);
- } else if (p.type == content::NPVARIANT_PARAM_STRING) {
- WriteParam(m, p.string_value);
- } else if (p.type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- p.type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- // This is the routing id used to connect NPObjectProxy in the other
- // process with NPObjectStub in this process or to identify the raw
- // npobject pointer to be used in the callee process.
- WriteParam(m, p.npobject_routing_id);
- } else {
- DCHECK(p.type == content::NPVARIANT_PARAM_VOID ||
- p.type == content::NPVARIANT_PARAM_NULL);
- }
-}
-
-bool ParamTraits<NPVariant_Param>::Read(const Message* m,
- PickleIterator* iter,
- param_type* r) {
- int type;
- if (!ReadParam(m, iter, &type))
- return false;
-
- bool result = false;
- r->type = static_cast<content::NPVariant_ParamEnum>(type);
- if (r->type == content::NPVARIANT_PARAM_BOOL) {
- result = ReadParam(m, iter, &r->bool_value);
- } else if (r->type == content::NPVARIANT_PARAM_INT) {
- result = ReadParam(m, iter, &r->int_value);
- } else if (r->type == content::NPVARIANT_PARAM_DOUBLE) {
- result = ReadParam(m, iter, &r->double_value);
- } else if (r->type == content::NPVARIANT_PARAM_STRING) {
- result = ReadParam(m, iter, &r->string_value);
- } else if (r->type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- r->type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- result = ReadParam(m, iter, &r->npobject_routing_id);
- } else if ((r->type == content::NPVARIANT_PARAM_VOID) ||
- (r->type == content::NPVARIANT_PARAM_NULL)) {
- result = true;
- } else {
- NOTREACHED();
- }
-
- return result;
-}
-
-void ParamTraits<NPVariant_Param>::Log(const param_type& p, std::string* l) {
- l->append(
- base::StringPrintf("NPVariant_Param(%d, ", static_cast<int>(p.type)));
- if (p.type == content::NPVARIANT_PARAM_BOOL) {
- LogParam(p.bool_value, l);
- } else if (p.type == content::NPVARIANT_PARAM_INT) {
- LogParam(p.int_value, l);
- } else if (p.type == content::NPVARIANT_PARAM_DOUBLE) {
- LogParam(p.double_value, l);
- } else if (p.type == content::NPVARIANT_PARAM_STRING) {
- LogParam(p.string_value, l);
- } else if (p.type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- p.type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- LogParam(p.npobject_routing_id, l);
- } else {
- l->append("<none>");
- }
- l->append(")");
-}
-
-void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) {
- webkit_glue::SerializeNPIdentifier(p.identifier, m);
-}
-
-bool ParamTraits<NPIdentifier_Param>::Read(const Message* m,
- PickleIterator* iter,
- param_type* r) {
- return webkit_glue::DeserializeNPIdentifier(iter, &r->identifier);
-}
-
-void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) {
- if (WebKit::WebBindings::identifierIsString(p.identifier)) {
- NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier);
- l->append(str);
- webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(str);
- } else {
- l->append(base::IntToString(
- WebKit::WebBindings::intFromIdentifier(p.identifier)));
- }
-}
-
void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) {
m->WriteUInt64(r.start());
m->WriteUInt64(r.end());
diff --git a/content/common/content_param_traits.h b/content/common/content_param_traits.h
index 098f2fd..8b012d1 100644
--- a/content/common/content_param_traits.h
+++ b/content/common/content_param_traits.h
@@ -16,7 +16,6 @@
#include "content/common/content_param_traits_macros.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "webkit/glue/npruntime_util.h"
#include "webkit/glue/webcursor.h"
namespace net {
@@ -27,47 +26,6 @@ namespace ui {
class Range;
}
-namespace content {
-
-// Define the NPVariant_Param struct and its enum here since it needs manual
-// serialization code.
-enum NPVariant_ParamEnum {
- NPVARIANT_PARAM_VOID,
- NPVARIANT_PARAM_NULL,
- NPVARIANT_PARAM_BOOL,
- NPVARIANT_PARAM_INT,
- NPVARIANT_PARAM_DOUBLE,
- NPVARIANT_PARAM_STRING,
- // Used when when the NPObject is running in the caller's process, so we
- // create an NPObjectProxy in the other process.
- NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID,
- // Used when the NPObject we're sending is running in the callee's process
- // (i.e. we have an NPObjectProxy for it). In that case we want the callee
- // to just use the raw pointer.
- NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID,
-};
-
-struct NPVariant_Param {
- NPVariant_Param();
- ~NPVariant_Param();
-
- NPVariant_ParamEnum type;
- bool bool_value;
- int int_value;
- double double_value;
- std::string string_value;
- int npobject_routing_id;
-};
-
-struct NPIdentifier_Param {
- NPIdentifier_Param();
- ~NPIdentifier_Param();
-
- NPIdentifier identifier;
-};
-
-} // namespace content
-
namespace IPC {
template <>
@@ -79,22 +37,6 @@ struct ParamTraits<net::IPEndPoint> {
};
template <>
-struct ParamTraits<content::NPVariant_Param> {
- typedef content::NPVariant_Param param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* r);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<content::NPIdentifier_Param> {
- typedef content::NPIdentifier_Param param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* r);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct ParamTraits<ui::Range> {
typedef ui::Range param_type;
static void Write(Message* m, const param_type& p);
diff --git a/content/common/java_bridge_messages.h b/content/common/java_bridge_messages.h
index de9f234..282cebc 100644
--- a/content/common/java_bridge_messages.h
+++ b/content/common/java_bridge_messages.h
@@ -6,7 +6,9 @@
// Multiply-included message file, hence no include guard.
-#include "content/common/content_param_traits.h"
+#if defined(ENABLE_JAVA_BRIDGE)
+
+#include "content/common/plugin_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
@@ -34,3 +36,5 @@ IPC_SYNC_MESSAGE_CONTROL0_1(JavaBridgeMsg_GenerateRouteID,
// Sent from renderer to browser to get the channel handle for NP channel.
IPC_SYNC_MESSAGE_ROUTED0_1(JavaBridgeHostMsg_GetChannelHandle,
IPC::ChannelHandle) /* channel handle */
+
+#endif // defined(ENABLE_JAVA_BRIDGE)
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
index 1dac381..1c0407d 100644
--- a/content/common/pepper_plugin_registry.cc
+++ b/content/common/pepper_plugin_registry.cc
@@ -12,7 +12,6 @@
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
-#include "webkit/plugins/npapi/plugin_list.h"
namespace content {
namespace {
diff --git a/content/common/plugin_message_generator.cc b/content/common/plugin_message_generator.cc
new file mode 100644
index 0000000..b44b164
--- /dev/null
+++ b/content/common/plugin_message_generator.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2013 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.
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "content/common/plugin_message_generator.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "content/common/plugin_message_generator.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "content/common/plugin_message_generator.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "content/common/plugin_message_generator.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "content/common/plugin_message_generator.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "content/common/plugin_message_generator.h"
+} // namespace IPC
diff --git a/content/common/plugin_message_generator.h b/content/common/plugin_message_generator.h
new file mode 100644
index 0000000..985290f
--- /dev/null
+++ b/content/common/plugin_message_generator.h
@@ -0,0 +1,7 @@
+// Copyright (c) 2013 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.
+
+// Multiply-included file, hence no include guard.
+
+#include "content/common/plugin_messages.h"
diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h
index db33468..2fa0883 100644
--- a/content/common/plugin_messages.h
+++ b/content/common/plugin_messages.h
@@ -7,6 +7,7 @@
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/common/content_param_traits.h"
+#include "content/common/plugin_param_traits.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
diff --git a/content/common/plugin_param_traits.cc b/content/common/plugin_param_traits.cc
new file mode 100644
index 0000000..0aec10d
--- /dev/null
+++ b/content/common/plugin_param_traits.cc
@@ -0,0 +1,133 @@
+// Copyright (c) 2013 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.
+
+#include "content/common/plugin_param_traits.h"
+
+#include "base/strings/string_number_conversions.h"
+#include "ipc/ipc_message_utils.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
+#include "webkit/glue/npruntime_util.h"
+#include "webkit/plugins/npapi/plugin_host.h"
+
+namespace content {
+
+NPIdentifier_Param::NPIdentifier_Param()
+ : identifier() {
+}
+
+NPIdentifier_Param::~NPIdentifier_Param() {
+}
+
+NPVariant_Param::NPVariant_Param()
+ : type(NPVARIANT_PARAM_VOID),
+ bool_value(false),
+ int_value(0),
+ double_value(0),
+ npobject_routing_id(-1) {
+}
+
+NPVariant_Param::~NPVariant_Param() {
+}
+
+} // namespace content
+
+using content::NPIdentifier_Param;
+using content::NPVariant_Param;
+
+namespace IPC {
+
+void ParamTraits<NPVariant_Param>::Write(Message* m, const param_type& p) {
+ WriteParam(m, static_cast<int>(p.type));
+ if (p.type == content::NPVARIANT_PARAM_BOOL) {
+ WriteParam(m, p.bool_value);
+ } else if (p.type == content::NPVARIANT_PARAM_INT) {
+ WriteParam(m, p.int_value);
+ } else if (p.type == content::NPVARIANT_PARAM_DOUBLE) {
+ WriteParam(m, p.double_value);
+ } else if (p.type == content::NPVARIANT_PARAM_STRING) {
+ WriteParam(m, p.string_value);
+ } else if (p.type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
+ p.type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
+ // This is the routing id used to connect NPObjectProxy in the other
+ // process with NPObjectStub in this process or to identify the raw
+ // npobject pointer to be used in the callee process.
+ WriteParam(m, p.npobject_routing_id);
+ } else {
+ DCHECK(p.type == content::NPVARIANT_PARAM_VOID ||
+ p.type == content::NPVARIANT_PARAM_NULL);
+ }
+}
+
+bool ParamTraits<NPVariant_Param>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ int type;
+ if (!ReadParam(m, iter, &type))
+ return false;
+
+ bool result = false;
+ r->type = static_cast<content::NPVariant_ParamEnum>(type);
+ if (r->type == content::NPVARIANT_PARAM_BOOL) {
+ result = ReadParam(m, iter, &r->bool_value);
+ } else if (r->type == content::NPVARIANT_PARAM_INT) {
+ result = ReadParam(m, iter, &r->int_value);
+ } else if (r->type == content::NPVARIANT_PARAM_DOUBLE) {
+ result = ReadParam(m, iter, &r->double_value);
+ } else if (r->type == content::NPVARIANT_PARAM_STRING) {
+ result = ReadParam(m, iter, &r->string_value);
+ } else if (r->type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
+ r->type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
+ result = ReadParam(m, iter, &r->npobject_routing_id);
+ } else if ((r->type == content::NPVARIANT_PARAM_VOID) ||
+ (r->type == content::NPVARIANT_PARAM_NULL)) {
+ result = true;
+ } else {
+ NOTREACHED();
+ }
+
+ return result;
+}
+
+void ParamTraits<NPVariant_Param>::Log(const param_type& p, std::string* l) {
+ l->append(
+ base::StringPrintf("NPVariant_Param(%d, ", static_cast<int>(p.type)));
+ if (p.type == content::NPVARIANT_PARAM_BOOL) {
+ LogParam(p.bool_value, l);
+ } else if (p.type == content::NPVARIANT_PARAM_INT) {
+ LogParam(p.int_value, l);
+ } else if (p.type == content::NPVARIANT_PARAM_DOUBLE) {
+ LogParam(p.double_value, l);
+ } else if (p.type == content::NPVARIANT_PARAM_STRING) {
+ LogParam(p.string_value, l);
+ } else if (p.type == content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
+ p.type == content::NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
+ LogParam(p.npobject_routing_id, l);
+ } else {
+ l->append("<none>");
+ }
+ l->append(")");
+}
+
+void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) {
+ webkit_glue::SerializeNPIdentifier(p.identifier, m);
+}
+
+bool ParamTraits<NPIdentifier_Param>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ return webkit_glue::DeserializeNPIdentifier(iter, &r->identifier);
+}
+
+void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) {
+ if (WebKit::WebBindings::identifierIsString(p.identifier)) {
+ NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier);
+ l->append(str);
+ webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(str);
+ } else {
+ l->append(base::IntToString(
+ WebKit::WebBindings::intFromIdentifier(p.identifier)));
+ }
+}
+
+} // namespace IPC
diff --git a/content/common/plugin_param_traits.h b/content/common/plugin_param_traits.h
new file mode 100644
index 0000000..bd616f3
--- /dev/null
+++ b/content/common/plugin_param_traits.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2013 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.
+
+// This file is used to define IPC::ParamTraits<> specializations for a number
+// of types so that they can be serialized over IPC. IPC::ParamTraits<>
+// specializations for basic types (like int and std::string) and types in the
+// 'base' project can be found in ipc/ipc_message_utils.h. This file contains
+// specializations for types that are used by the content code, and which need
+// manual serialization code. This is usually because they're not structs with
+// public members, or because the same type is being used in multiple
+// *_messages.h headers.
+
+#ifndef CONTENT_COMMON_PLUGIN_PARAM_TRAITS_H_
+#define CONTENT_COMMON_PLUGIN_PARAM_TRAITS_H_
+
+#include <string>
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_param_traits.h"
+#include "webkit/glue/npruntime_util.h"
+
+namespace content {
+
+// Define the NPVariant_Param struct and its enum here since it needs manual
+// serialization code.
+enum NPVariant_ParamEnum {
+ NPVARIANT_PARAM_VOID,
+ NPVARIANT_PARAM_NULL,
+ NPVARIANT_PARAM_BOOL,
+ NPVARIANT_PARAM_INT,
+ NPVARIANT_PARAM_DOUBLE,
+ NPVARIANT_PARAM_STRING,
+ // Used when when the NPObject is running in the caller's process, so we
+ // create an NPObjectProxy in the other process.
+ NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID,
+ // Used when the NPObject we're sending is running in the callee's process
+ // (i.e. we have an NPObjectProxy for it). In that case we want the callee
+ // to just use the raw pointer.
+ NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID,
+};
+
+struct NPVariant_Param {
+ NPVariant_Param();
+ ~NPVariant_Param();
+
+ NPVariant_ParamEnum type;
+ bool bool_value;
+ int int_value;
+ double double_value;
+ std::string string_value;
+ int npobject_routing_id;
+};
+
+struct NPIdentifier_Param {
+ NPIdentifier_Param();
+ ~NPIdentifier_Param();
+
+ NPIdentifier identifier;
+};
+
+} // namespace content
+
+namespace IPC {
+
+template <>
+struct ParamTraits<content::NPVariant_Param> {
+ typedef content::NPVariant_Param param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<content::NPIdentifier_Param> {
+ typedef content::NPIdentifier_Param param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+} // namespace IPC
+
+#endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_
diff --git a/content/content.gyp b/content/content.gyp
index 69bc5d0..7bbbb7b 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -47,6 +47,7 @@
'dependencies': [
'content_app',
'content_browser',
+ 'content_common_plugin',
'content_common',
],
'conditions': [
@@ -96,6 +97,11 @@
'content_gpu',
],
}],
+ ['java_bridge==1', {
+ 'dependencies': [
+ 'content_common_plugin',
+ ]
+ }]
],
},
{
@@ -115,6 +121,24 @@
# Disable c4267 warnings until we fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
+ {
+ 'target_name': 'content_common_plugin',
+ 'type': 'static_library',
+ 'variables': { 'enable_wexit_time_destructors': 1, },
+ 'includes': [
+ 'content_common_plugin.gypi',
+ ],
+ 'conditions': [
+ ['OS != "ios"', {
+ 'dependencies': [
+ 'content_resources.gyp:content_resources',
+ ],
+ }],
+ ],
+ # Disable c4267 warnings until we fix size_t to int truncations.
+ 'msvs_disabled_warnings': [ 4267, ],
+ },
+
],
'conditions': [
['OS != "ios"', {
@@ -138,6 +162,7 @@
'content_plugin.gypi',
],
'dependencies': [
+ 'content_common_plugin',
'content_common',
],
},
@@ -159,6 +184,7 @@
'content_renderer.gypi',
],
'dependencies': [
+ 'content_common_plugin',
'content_common',
'content_resources.gyp:content_resources',
],
@@ -208,6 +234,7 @@
'includes': [
'content_app.gypi',
'content_browser.gypi',
+ 'content_common_plugin.gypi',
'content_common.gypi',
'content_gpu.gypi',
'content_plugin.gypi',
@@ -244,6 +271,11 @@
'msvs_disabled_warnings': [ 4267, ],
},
{
+ 'target_name': 'content_common_plugin',
+ 'type': 'none',
+ 'dependencies': ['content'],
+ },
+ {
'target_name': 'content_gpu',
'type': 'none',
'dependencies': ['content'],
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 992ce00..d08f75e 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -300,15 +300,6 @@
'common/net/url_fetcher.cc',
'common/net/url_request_user_data.cc',
'common/net/url_request_user_data.h',
- 'common/np_channel_base.cc',
- 'common/np_channel_base.h',
- 'common/npobject_base.h',
- 'common/npobject_proxy.cc',
- 'common/npobject_proxy.h',
- 'common/npobject_stub.cc',
- 'common/npobject_stub.h',
- 'common/npobject_util.cc',
- 'common/npobject_util.h',
'common/p2p_messages.h',
'common/p2p_sockets.h',
'common/page_zoom.cc',
@@ -321,7 +312,6 @@
'common/pepper_renderer_instance_data.h',
'common/plugin_carbon_interpose_constants_mac.cc',
'common/plugin_carbon_interpose_constants_mac.h',
- 'common/plugin_messages.h',
'common/process_type.cc',
'common/quota_messages.h',
'common/quota_dispatcher.cc',
@@ -420,7 +410,6 @@
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:shared_memory_support',
'../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit',
- '../third_party/npapi/npapi.gyp:npapi',
'../ui/gl/gl.gyp:gl',
'../webkit/support/webkit_support.gyp:glue',
'../webkit/support/webkit_support.gyp:webkit_base',
@@ -488,6 +477,11 @@
'common/gpu/media/android_video_decode_accelerator.h',
],
}],
+ ['java_bridge==1', {
+ 'defines': [
+ 'ENABLE_JAVA_BRIDGE',
+ ],
+ }],
['target_arch=="arm" and chromeos == 1 and use_x11 == 1', {
'dependencies': [
'../media/media.gyp:media',
diff --git a/content/content_common_plugin.gypi b/content/content_common_plugin.gypi
new file mode 100644
index 0000000..4fcf28c
--- /dev/null
+++ b/content/content_common_plugin.gypi
@@ -0,0 +1,50 @@
+# Copyright (c) 2012 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.
+
+{
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../build/temp_gyp/googleurl.gyp:googleurl',
+ '../components/tracing.gyp:tracing',
+ '../ui/ui.gyp:ui',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'export_dependent_settings': [
+ '../base/base.gyp:base',
+ ],
+ 'sources': [
+ 'common/np_channel_base.cc',
+ 'common/np_channel_base.h',
+ 'common/npobject_base.h',
+ 'common/npobject_proxy.cc',
+ 'common/npobject_proxy.h',
+ 'common/npobject_stub.cc',
+ 'common/npobject_stub.h',
+ 'common/npobject_util.cc',
+ 'common/npobject_util.h',
+ 'common/plugin_messages.h',
+ 'common/plugin_param_traits.cc',
+ 'common/plugin_param_traits.h',
+ 'common/plugin_message_generator.cc',
+ 'common/plugin_message_generator.h',
+ ],
+ 'conditions': [
+ ['OS=="ios"', {
+ 'sources/': [
+ # iOS only needs a small portion of content; exclude all the
+ # implementation, and re-include what is used.
+ ['exclude', '\\.(cc|mm)$'],
+ ],
+ }, { # OS!="ios"
+ 'dependencies': [
+ '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit',
+ '../third_party/npapi/npapi.gyp:npapi',
+ '../webkit/support/webkit_support.gyp:glue',
+ '../webkit/support/webkit_support.gyp:webkit_base',
+ ],
+ }],
+ ],
+}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 5e33387..f4bf365 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1088,7 +1088,9 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
OnSetHistoryLengthAndPrune)
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
+#if defined(ENABLE_JAVA_BRIDGE)
IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit)
+#endif
IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener)
#if defined(OS_ANDROID)
@@ -6407,12 +6409,12 @@ void RenderViewImpl::OnEnableViewSourceMode() {
main_frame->enableViewSourceMode(true);
}
+#if defined(ENABLE_JAVA_BRIDGE)
void RenderViewImpl::OnJavaBridgeInit() {
DCHECK(!java_bridge_dispatcher_);
-#if defined(ENABLE_JAVA_BRIDGE)
java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
-#endif
}
+#endif
void RenderViewImpl::OnDisownOpener() {
if (!webview())