summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:36:46 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:36:46 +0000
commit173de1be12780200c62bae5c01965d51ac0eaa31 (patch)
tree5ab851b72e8012f49a4d80b281744a6b64d40753 /chrome/browser
parent1f2763de9d897fc2b0e6da4c2323b7d8ab70c687 (diff)
downloadchromium_src-173de1be12780200c62bae5c01965d51ac0eaa31.zip
chromium_src-173de1be12780200c62bae5c01965d51ac0eaa31.tar.gz
chromium_src-173de1be12780200c62bae5c01965d51ac0eaa31.tar.bz2
Step 1 at making Gears run in the renderer process (enabled by switch
"--gears-in-renderer"). Requires some changes to gears to work. Most things work if you disable the sandbox. One major hole is that update tasks don't report status to the appropriate renderer. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chrome_plugin_host.cc8
-rw-r--r--chrome/browser/render_process_host.cc3
-rw-r--r--chrome/browser/resource_message_filter.cc20
-rw-r--r--chrome/browser/resource_message_filter.h4
4 files changed, 34 insertions, 1 deletions
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 65600b8..ed6c6f5 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -31,6 +31,7 @@
#include <set>
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/histogram.h"
#include "base/message_loop.h"
@@ -52,6 +53,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_plugin_util.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/net/url_request_intercept_job.h"
#include "chrome/common/plugin_messages.h"
@@ -658,6 +660,12 @@ CPProcessType STDCALL CPB_GetProcessType(CPID id) {
}
CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) {
+ CommandLine cmd;
+ if (cmd.HasSwitch(switches::kGearsInRenderer)) {
+ // TODO(mpcomplete): figure out what to do here.
+ return CPERR_FAILURE;
+ }
+
CHECK(ChromePluginLib::IsPluginThread());
ChromePluginLib* plugin = ChromePluginLib::FromCPID(id);
CHECK(plugin);
diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc
index 558a161..aff2ba0 100644
--- a/chrome/browser/render_process_host.cc
+++ b/chrome/browser/render_process_host.cc
@@ -289,7 +289,8 @@ bool RenderProcessHost::Init() {
switches::kEnableDCHECK,
switches::kSilentDumpOnDCHECK,
switches::kDisablePopupBlocking,
- switches::kUseLowFragHeapCrt
+ switches::kUseLowFragHeapCrt,
+ switches::kGearsInRenderer,
};
for (int i = 0; i < arraysize(switch_names); ++i) {
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc
index d5234a8..99b188c 100644
--- a/chrome/browser/resource_message_filter.cc
+++ b/chrome/browser/resource_message_filter.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/render_process_host.h"
#include "chrome/browser/render_widget_helper.h"
#include "chrome/browser/spellchecker.h"
+#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/clipboard_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -167,6 +168,8 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetCookies, OnGetCookies)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_GetDataDir, OnGetDataDir)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_PluginMessage, OnPluginMessage)
IPC_MESSAGE_HANDLER(ViewHostMsg_LoadFont, OnLoadFont)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetMonitorInfoForWindow,
OnGetMonitorInfoForWindow)
@@ -362,6 +365,23 @@ void ResourceMessageFilter::OnGetCookies(const GURL& url,
*cookies = request_context_->cookie_store()->GetCookies(url);
}
+void ResourceMessageFilter::OnGetDataDir(std::wstring* data_dir) {
+ *data_dir = plugin_service_->GetChromePluginDataDir();
+}
+
+void ResourceMessageFilter::OnPluginMessage(const std::wstring& dll_path,
+ const std::vector<uint8>& data) {
+ DCHECK(MessageLoop::current() ==
+ ChromeThread::GetMessageLoop(ChromeThread::IO));
+
+ ChromePluginLib *chrome_plugin = ChromePluginLib::Find(dll_path);
+ if (chrome_plugin) {
+ void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
+ uint32 data_len = static_cast<uint32>(data.size());
+ chrome_plugin->functions().on_message(data_ptr, data_len);
+ }
+}
+
void ResourceMessageFilter::OnGetPlugins(bool refresh,
std::vector<WebPluginInfo>* plugins) {
plugin_service_->GetPlugins(refresh, plugins);
diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h
index a5525e7..31dff65 100644
--- a/chrome/browser/resource_message_filter.h
+++ b/chrome/browser/resource_message_filter.h
@@ -103,6 +103,10 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
const std::string& cookie);
void OnGetCookies(const GURL& url, const GURL& policy_url,
std::string* cookies);
+ void OnGetDataDir(std::wstring* data_dir);
+ void OnPluginMessage(const std::wstring& dll_path,
+ const std::vector<uint8>& message);
+
// Cache fonts for the renderer. See ResourceMessageFilter::OnLoadFont
// implementation for more details
void OnLoadFont(LOGFONT font);