| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 5 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
| 9 #include "content/common/file_utilities_messages.h" | 9 #include "content/common/file_utilities_messages.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 FileUtilitiesMessageFilter::FileUtilitiesMessageFilter(int process_id) | 13 FileUtilitiesMessageFilter::FileUtilitiesMessageFilter(int process_id) |
| 14 : BrowserMessageFilter(FileUtilitiesMsgStart), | 14 : process_id_(process_id) { |
| 15 process_id_(process_id) { | |
| 16 } | 15 } |
| 17 | 16 |
| 18 FileUtilitiesMessageFilter::~FileUtilitiesMessageFilter() { | 17 FileUtilitiesMessageFilter::~FileUtilitiesMessageFilter() { |
| 19 } | 18 } |
| 20 | 19 |
| 21 void FileUtilitiesMessageFilter::OverrideThreadForMessage( | 20 void FileUtilitiesMessageFilter::OverrideThreadForMessage( |
| 22 const IPC::Message& message, | 21 const IPC::Message& message, |
| 23 BrowserThread::ID* thread) { | 22 BrowserThread::ID* thread) { |
| 24 if (IPC_MESSAGE_CLASS(message) == FileUtilitiesMsgStart) | 23 if (IPC_MESSAGE_CLASS(message) == FileUtilitiesMsgStart) |
| 25 *thread = BrowserThread::FILE; | 24 *thread = BrowserThread::FILE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( | 46 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
| 48 process_id_, path)) { | 47 process_id_, path)) { |
| 49 return; | 48 return; |
| 50 } | 49 } |
| 51 | 50 |
| 52 if (!base::GetFileInfo(path, result)) | 51 if (!base::GetFileInfo(path, result)) |
| 53 *status = base::File::FILE_ERROR_FAILED; | 52 *status = base::File::FILE_ERROR_FAILED; |
| 54 } | 53 } |
| 55 | 54 |
| 56 } // namespace content | 55 } // namespace content |
| OLD | NEW |