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 "chrome/browser/devtools/devtools_file_helper.h" | 5 #include "chrome/browser/devtools/devtools_file_helper.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 std::string file_system_id = isolated_context()->RegisterFileSystemForPath( | 145 std::string file_system_id = isolated_context()->RegisterFileSystemForPath( |
146 fileapi::kFileSystemTypeNativeLocal, path, registered_name); | 146 fileapi::kFileSystemTypeNativeLocal, path, registered_name); |
147 | 147 |
148 content::ChildProcessSecurityPolicy* policy = | 148 content::ChildProcessSecurityPolicy* policy = |
149 content::ChildProcessSecurityPolicy::GetInstance(); | 149 content::ChildProcessSecurityPolicy::GetInstance(); |
150 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); | 150 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); |
151 int renderer_id = render_view_host->GetProcess()->GetID(); | 151 int renderer_id = render_view_host->GetProcess()->GetID(); |
152 policy->GrantReadFileSystem(renderer_id, file_system_id); | 152 policy->GrantReadFileSystem(renderer_id, file_system_id); |
153 policy->GrantWriteFileSystem(renderer_id, file_system_id); | 153 policy->GrantWriteFileSystem(renderer_id, file_system_id); |
154 policy->GrantCreateFileForFileSystem(renderer_id, file_system_id); | 154 policy->GrantCreateFileForFileSystem(renderer_id, file_system_id); |
| 155 policy->GrantDeleteFromFileSystem(renderer_id, file_system_id); |
155 | 156 |
156 // We only need file level access for reading FileEntries. Saving FileEntries | 157 // We only need file level access for reading FileEntries. Saving FileEntries |
157 // just needs the file system to have read/write access, which is granted | 158 // just needs the file system to have read/write access, which is granted |
158 // above if required. | 159 // above if required. |
159 if (!policy->CanReadFile(renderer_id, path)) | 160 if (!policy->CanReadFile(renderer_id, path)) |
160 policy->GrantReadFile(renderer_id, path); | 161 policy->GrantReadFile(renderer_id, path); |
161 | 162 |
162 return file_system_id; | 163 return file_system_id; |
163 } | 164 } |
164 | 165 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 DictionaryValue* file_systems_paths_value = update.Get(); | 392 DictionaryValue* file_systems_paths_value = update.Get(); |
392 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); | 393 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); |
393 } | 394 } |
394 | 395 |
395 bool DevToolsFileHelper::IsFileSystemAdded( | 396 bool DevToolsFileHelper::IsFileSystemAdded( |
396 const std::string& file_system_path) { | 397 const std::string& file_system_path) { |
397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
398 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); | 399 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); |
399 return file_system_paths.find(file_system_path) != file_system_paths.end(); | 400 return file_system_paths.find(file_system_path) != file_system_paths.end(); |
400 } | 401 } |
OLD | NEW |