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/worker_host/worker_process_host.h" | 5 #include "content/browser/worker_host/worker_process_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "content/browser/worker_host/worker_message_filter.h" | 34 #include "content/browser/worker_host/worker_message_filter.h" |
35 #include "content/browser/worker_host/worker_service.h" | 35 #include "content/browser/worker_host/worker_service.h" |
36 #include "content/common/debug_flags.h" | 36 #include "content/common/debug_flags.h" |
37 #include "content/common/result_codes.h" | 37 #include "content/common/result_codes.h" |
38 #include "content/common/worker_messages.h" | 38 #include "content/common/worker_messages.h" |
39 #include "net/base/mime_util.h" | 39 #include "net/base/mime_util.h" |
40 #include "ipc/ipc_switches.h" | 40 #include "ipc/ipc_switches.h" |
41 #include "net/base/registry_controlled_domain.h" | 41 #include "net/base/registry_controlled_domain.h" |
42 #include "webkit/glue/resource_type.h" | 42 #include "webkit/glue/resource_type.h" |
43 #include "webkit/fileapi/file_system_path_manager.h" | 43 #include "webkit/fileapi/file_system_path_manager.h" |
| 44 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
47 // Helper class that we pass to SocketStreamDispatcherHost so that it can find | 48 // Helper class that we pass to SocketStreamDispatcherHost so that it can find |
48 // the right net::URLRequestContext for a request. | 49 // the right net::URLRequestContext for a request. |
49 class URLRequestContextOverride | 50 class URLRequestContextOverride |
50 : public ResourceMessageFilter::URLRequestContextOverride { | 51 : public ResourceMessageFilter::URLRequestContextOverride { |
51 public: | 52 public: |
52 explicit URLRequestContextOverride( | 53 explicit URLRequestContextOverride( |
53 net::URLRequestContext* url_request_context) | 54 net::URLRequestContext* url_request_context) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 ChildProcessSecurityPolicy::GetInstance()->Add(id()); | 177 ChildProcessSecurityPolicy::GetInstance()->Add(id()); |
177 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 178 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
178 switches::kDisableFileSystem)) { | 179 switches::kDisableFileSystem)) { |
179 // Grant most file permissions to this worker. | 180 // Grant most file permissions to this worker. |
180 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 181 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
181 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 182 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
182 // requests them. | 183 // requests them. |
183 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 184 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
184 id(), | 185 id(), |
185 GetChromeURLRequestContext()->file_system_context()-> | 186 GetChromeURLRequestContext()->file_system_context()-> |
186 path_manager()->base_path(), | 187 path_manager()->sandbox_provider()->base_path(), |
187 base::PLATFORM_FILE_OPEN | | 188 base::PLATFORM_FILE_OPEN | |
188 base::PLATFORM_FILE_CREATE | | 189 base::PLATFORM_FILE_CREATE | |
189 base::PLATFORM_FILE_OPEN_ALWAYS | | 190 base::PLATFORM_FILE_OPEN_ALWAYS | |
190 base::PLATFORM_FILE_CREATE_ALWAYS | | 191 base::PLATFORM_FILE_CREATE_ALWAYS | |
191 base::PLATFORM_FILE_READ | | 192 base::PLATFORM_FILE_READ | |
192 base::PLATFORM_FILE_WRITE | | 193 base::PLATFORM_FILE_WRITE | |
193 base::PLATFORM_FILE_EXCLUSIVE_READ | | 194 base::PLATFORM_FILE_EXCLUSIVE_READ | |
194 base::PLATFORM_FILE_EXCLUSIVE_WRITE | | 195 base::PLATFORM_FILE_EXCLUSIVE_WRITE | |
195 base::PLATFORM_FILE_ASYNC | | 196 base::PLATFORM_FILE_ASYNC | |
196 base::PLATFORM_FILE_TRUNCATE | | 197 base::PLATFORM_FILE_TRUNCATE | |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 604 } |
604 } | 605 } |
605 return false; | 606 return false; |
606 } | 607 } |
607 | 608 |
608 WorkerProcessHost::WorkerInstance::FilterInfo | 609 WorkerProcessHost::WorkerInstance::FilterInfo |
609 WorkerProcessHost::WorkerInstance::GetFilter() const { | 610 WorkerProcessHost::WorkerInstance::GetFilter() const { |
610 DCHECK(NumFilters() == 1); | 611 DCHECK(NumFilters() == 1); |
611 return *filters_.begin(); | 612 return *filters_.begin(); |
612 } | 613 } |
OLD | NEW |