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

Side by Side Diff: chrome/browser/devtools/devtools_file_helper.cc

Issue 31663002: ChildProcessSecurityPolicy: Add DeleteFromFileSystem permission. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698