Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1591)

Unified Diff: content/browser/renderer_host/file_utilities_message_filter.cc

Issue 10323002: Move message handlers that don't belong in RenderProcessHostImpl to their own files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: threaded Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/file_utilities_message_filter.cc
diff --git a/content/browser/renderer_host/file_utilities_message_filter.cc b/content/browser/renderer_host/file_utilities_message_filter.cc
index e72916cde00582316531f63c31951cc34c500f73..24dab97d1fcf845ad29a5912069cf8d0215c80d0 100644
--- a/content/browser/renderer_host/file_utilities_message_filter.cc
+++ b/content/browser/renderer_host/file_utilities_message_filter.cc
@@ -7,6 +7,7 @@
#include "base/file_util.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/common/file_utilities_messages.h"
+#include "content/public/browser/content_browser_client.h"
using content::BrowserThread;
@@ -20,7 +21,9 @@ FileUtilitiesMessageFilter::~FileUtilitiesMessageFilter() {
void FileUtilitiesMessageFilter::OverrideThreadForMessage(
const IPC::Message& message,
BrowserThread::ID* thread) {
- if (IPC_MESSAGE_CLASS(message) == FileUtilitiesMsgStart)
+ if (message.type() == FileUtilitiesMsg_RevealFolderInOS::ID)
+ *thread = BrowserThread::UI;
+ else if (IPC_MESSAGE_CLASS(message) == FileUtilitiesMsgStart)
*thread = BrowserThread::FILE;
}
@@ -32,6 +35,7 @@ bool FileUtilitiesMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileModificationTime,
OnGetFileModificationTime)
IPC_MESSAGE_HANDLER(FileUtilitiesMsg_OpenFile, OnOpenFile)
+ IPC_MESSAGE_HANDLER(FileUtilitiesMsg_RevealFolderInOS, OnRevealFolderInOS)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -107,3 +111,10 @@ void FileUtilitiesMessageFilter::OnOpenFile(
*result = base::FileDescriptor(file_handle, true);
#endif
}
+
+void FileUtilitiesMessageFilter::OnRevealFolderInOS(const FilePath& path) {
+ // Only honor the request if appropriate permissions are granted.
+ if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(process_id_,
+ path))
+ content::GetContentClient()->browser()->OpenItem(path);
+}

Powered by Google App Engine
This is Rietveld 408576698