summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/plugin_process_host.cc4
-rw-r--r--chrome/browser/plugin_process_host.h2
-rw-r--r--chrome/common/plugin_messages_internal.h4
-rw-r--r--chrome/plugin/chrome_plugin_host.cc6
-rw-r--r--chrome/plugin/plugin_channel.cc19
-rw-r--r--chrome/plugin/plugin_channel.h11
-rw-r--r--chrome/plugin/plugin_thread.h6
-rw-r--r--chrome/plugin/webplugin_proxy.cc6
-rw-r--r--chrome/plugin/webplugin_proxy.h4
9 files changed, 36 insertions, 26 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 0befa1c..1ae4e25 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -537,7 +537,7 @@ void PluginProcessHost::OnGetCookies(uint32 request_context,
}
}
-void PluginProcessHost::OnAccessFiles(int process_id,
+void PluginProcessHost::OnAccessFiles(int renderer_id,
const std::vector<std::string>& files,
bool* allowed) {
ChildProcessSecurityPolicy* policy =
@@ -545,7 +545,7 @@ void PluginProcessHost::OnAccessFiles(int process_id,
for (size_t i = 0; i < files.size(); ++i) {
const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i]));
- if (!policy->CanUploadFile(process_id, path)) {
+ if (!policy->CanUploadFile(renderer_id, path)) {
LOG(INFO) << "Denied unauthorized request for file " << files[i];
*allowed = false;
return;
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 66b5098..a223503 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -97,7 +97,7 @@ class PluginProcessHost : public ChildProcessHost,
void OnGetPluginFinderUrl(std::string* plugin_finder_url);
void OnGetCookies(uint32 request_context, const GURL& url,
std::string* cookies);
- void OnAccessFiles(int process_id, const std::vector<std::string>& files,
+ void OnAccessFiles(int renderer_id, const std::vector<std::string>& files,
bool* allowed);
void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
void OnPluginMessage(const std::vector<uint8>& data);
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 795ee61..3c64bcf 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -74,10 +74,10 @@ IPC_BEGIN_MESSAGES(PluginProcessHost)
GURL /* url */,
std::string /* cookies */)
- // Used by the plugin process to verify that its renderer |process_id| has
+ // Used by the plugin process to verify that its renderer |renderer_id| has
// permission to access the given |files|.
IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_AccessFiles,
- int /* process_id */,
+ int /* renderer_id */,
std::vector<std::string> /* files */,
bool /* allowed */)
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index b724ca0..95a4862 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -362,8 +362,8 @@ CPError STDCALL CPB_AllowFileDrop(
if (!webplugin || !file_drag_data)
return CPERR_INVALID_PARAMETER;
- const int pid = webplugin->GetRendererProcessId();
- if (!pid)
+ const int renderer = webplugin->GetRendererId();
+ if (renderer == -1)
return CPERR_FAILURE;
static const char kDelimiter('\b');
@@ -372,7 +372,7 @@ CPError STDCALL CPB_AllowFileDrop(
bool allowed = false;
if (!PluginThread::current()->Send(
- new PluginProcessHostMsg_AccessFiles(pid, files, &allowed))) {
+ new PluginProcessHostMsg_AccessFiles(renderer, files, &allowed))) {
return CPERR_FAILURE;
}
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index c813e4c..f852a21 100644
--- a/chrome/plugin/plugin_channel.cc
+++ b/chrome/plugin/plugin_channel.cc
@@ -33,16 +33,23 @@ PluginChannel* PluginChannel::GetPluginChannel(int renderer_id,
std::string channel_name = StringPrintf(
"%d.r%d", base::GetCurrentProcId(), renderer_id);
- return static_cast<PluginChannel*>(PluginChannelBase::GetChannel(
- channel_name,
- IPC::Channel::MODE_SERVER,
- ClassFactory,
- ipc_message_loop,
- false));
+ PluginChannel* channel =
+ static_cast<PluginChannel*>(PluginChannelBase::GetChannel(
+ channel_name,
+ IPC::Channel::MODE_SERVER,
+ ClassFactory,
+ ipc_message_loop,
+ false));
+
+ if (channel)
+ channel->renderer_id_ = renderer_id;
+
+ return channel;
}
PluginChannel::PluginChannel()
: renderer_handle_(0),
+ renderer_id_(-1),
#if defined(OS_POSIX)
renderer_fd_(-1),
#endif
diff --git a/chrome/plugin/plugin_channel.h b/chrome/plugin/plugin_channel.h
index 58e711f..5e512f3 100644
--- a/chrome/plugin/plugin_channel.h
+++ b/chrome/plugin/plugin_channel.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -16,8 +16,8 @@
class PluginChannel : public PluginChannelBase {
public:
// Get a new PluginChannel object for the current process to talk to the
- // given rendeer process. The renderer ID is an opaque unique ID generated by
- // the browser.
+ // given renderer process. The renderer ID is an opaque unique ID generated
+ // by the browser.
//
// POSIX only: If |channel_fd| > 0, use that file descriptor for the
// channel socket.
@@ -30,6 +30,8 @@ class PluginChannel : public PluginChannelBase {
virtual void OnMessageReceived(const IPC::Message& message);
base::ProcessHandle renderer_handle() const { return renderer_handle_; }
+ int renderer_id() { return renderer_id_; }
+
int GenerateRouteID();
#if defined(OS_POSIX)
@@ -76,6 +78,9 @@ class PluginChannel : public PluginChannelBase {
// Handle to the renderer process who is on the other side of the channel.
base::ProcessHandle renderer_handle_;
+ // The id of the renderer who is on the other side of the channel.
+ int renderer_id_;
+
#if defined(OS_POSIX)
// FD for the renderer end of the pipe. It is stored until we send it over
// IPC after which it is cleared. It will be closed by the IPC mechanism.
diff --git a/chrome/plugin/plugin_thread.h b/chrome/plugin/plugin_thread.h
index 2e9803c..cc0e7f6 100644
--- a/chrome/plugin/plugin_thread.h
+++ b/chrome/plugin/plugin_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
@@ -31,9 +31,7 @@ class PluginThread : public ChildThread {
virtual void OnControlMessageReceived(const IPC::Message& msg);
// Callback for when a channel has been created.
- void OnCreateChannel(
- int process_id,
- bool off_the_record);
+ void OnCreateChannel(int renderer_id, bool off_the_record);
void OnPluginMessage(const std::vector<uint8> &data);
// The plugin module which is preloaded in Init
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 721a39e..0eb570a 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -266,10 +266,10 @@ WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) {
return iterator->second;
}
-int WebPluginProxy::GetRendererProcessId() {
+int WebPluginProxy::GetRendererId() {
if (channel_.get())
- return channel_->peer_pid();
- return 0;
+ return channel_->renderer_id();
+ return -1;
}
void WebPluginProxy::DidPaint() {
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 62b01ef..0ff1890 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -87,8 +87,8 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
// object with that id exists.
webkit_glue::WebPluginResourceClient* GetResourceClient(int id);
- // Returns the process id of the renderer that contains this plugin.
- int GetRendererProcessId();
+ // Returns the id of the renderer that contains this plugin.
+ int GetRendererId();
// For windowless plugins, paints the given rectangle into the local buffer.
void Paint(const gfx::Rect& rect);