| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pepper_file_message_filter.h" | 5 #include "content/browser/renderer_host/pepper_file_message_filter.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "content/browser/browser_context.h" | 12 #include "content/browser/browser_context.h" |
| 13 #include "content/browser/child_process_security_policy.h" | 13 #include "content/browser/child_process_security_policy.h" |
| 14 #include "content/browser/renderer_host/browser_render_process_host.h" | 14 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 15 #include "content/common/pepper_file_messages.h" | 15 #include "content/common/pepper_file_messages.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 18 #include "webkit/plugins/ppapi/file_path.h" | 18 #include "webkit/plugins/ppapi/file_path.h" |
| 19 | 19 |
| 20 #if defined(OS_POSIX) | 20 #if defined(OS_POSIX) |
| 21 #include "base/file_descriptor_posix.h" | 21 #include "base/file_descriptor_posix.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 using content::BrowserThread; |
| 25 |
| 24 // Used to check if the renderer has permission for the requested operation. | 26 // Used to check if the renderer has permission for the requested operation. |
| 25 // TODO(viettrungluu): Verify these. They don't necessarily quite make sense, | 27 // TODO(viettrungluu): Verify these. They don't necessarily quite make sense, |
| 26 // but it seems to be approximately what the file system code does. | 28 // but it seems to be approximately what the file system code does. |
| 27 const int kReadPermissions = base::PLATFORM_FILE_OPEN | | 29 const int kReadPermissions = base::PLATFORM_FILE_OPEN | |
| 28 base::PLATFORM_FILE_READ | | 30 base::PLATFORM_FILE_READ | |
| 29 base::PLATFORM_FILE_EXCLUSIVE_READ; | 31 base::PLATFORM_FILE_EXCLUSIVE_READ; |
| 30 const int kWritePermissions = base::PLATFORM_FILE_OPEN | | 32 const int kWritePermissions = base::PLATFORM_FILE_OPEN | |
| 31 base::PLATFORM_FILE_CREATE | | 33 base::PLATFORM_FILE_CREATE | |
| 32 base::PLATFORM_FILE_CREATE_ALWAYS | | 34 base::PLATFORM_FILE_CREATE_ALWAYS | |
| 33 base::PLATFORM_FILE_OPEN_TRUNCATED | | 35 base::PLATFORM_FILE_OPEN_TRUNCATED | |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (!pepper_path.path().IsAbsolute() && | 237 if (!pepper_path.path().IsAbsolute() && |
| 236 !pepper_path.path().ReferencesParent()) | 238 !pepper_path.path().ReferencesParent()) |
| 237 file_path = pepper_path_.Append(pepper_path.path()); | 239 file_path = pepper_path_.Append(pepper_path.path()); |
| 238 break; | 240 break; |
| 239 default: | 241 default: |
| 240 NOTREACHED(); | 242 NOTREACHED(); |
| 241 break; | 243 break; |
| 242 } | 244 } |
| 243 return file_path; | 245 return file_path; |
| 244 } | 246 } |
| OLD | NEW |