summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_process_host.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 20:36:49 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 20:36:49 +0000
commit351355117f4cb4ee805961920a7c9d2ad0ae944c (patch)
treeeaa3fce0cb3c27c349979f3b1d396cebd94b777d /chrome/browser/plugin_process_host.cc
parent77e82ef4ef098225b769b64d852f5c522b22f31d (diff)
downloadchromium_src-351355117f4cb4ee805961920a7c9d2ad0ae944c.zip
chromium_src-351355117f4cb4ee805961920a7c9d2ad0ae944c.tar.gz
chromium_src-351355117f4cb4ee805961920a7c9d2ad0ae944c.tar.bz2
CPAPI (0.11) for gears drag drop.
Provide a method that allows the gears plugin to ask the browser process to verify that its renderer has permission to access the drop files. Update the copyright notices. BUG=7995 Review URL: http://codereview.chromium.org/159074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_process_host.cc')
-rw-r--r--chrome/browser/plugin_process_host.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index f03b42f..ca2f502 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -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.
@@ -27,6 +27,7 @@
#include "base/scoped_ptr.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/chrome_plugin_browsing_context.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/plugin_service.h"
@@ -439,6 +440,7 @@ void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
OnGetPluginFinderUrl)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy,
OnResolveProxy)
#if defined(OS_WIN)
@@ -507,6 +509,24 @@ void PluginProcessHost::OnGetCookies(uint32 request_context,
*cookies = context->cookie_store()->GetCookies(url);
}
+void PluginProcessHost::OnAccessFiles(int process_id,
+ const std::vector<std::string>& files,
+ bool* allowed) {
+ ChildProcessSecurityPolicy* policy =
+ ChildProcessSecurityPolicy::GetInstance();
+
+ for (size_t i = 0; i < files.size(); ++i) {
+ const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i]));
+ if (!policy->CanUploadFile(process_id, path)) {
+ LOG(INFO) << "Denied unauthorized request for file " << files[i];
+ *allowed = false;
+ return;
+ }
+ }
+
+ *allowed = true;
+}
+
void PluginProcessHost::OnResolveProxy(const GURL& url,
IPC::Message* reply_msg) {
resolve_proxy_msg_helper_.Start(url, reply_msg);