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

Side by Side Diff: chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc

Issue 146283002: Apps: Grant sufficient permissions to the filesystem opened by fileSystem API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 6 years, 11 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 | no next file » | 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/extensions/api/file_handlers/app_file_handler_util.h" 5 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/child_process_security_policy.h" 10 #include "content/public/browser/child_process_security_policy.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 DCHECK(isolated_context); 326 DCHECK(isolated_context);
327 327
328 result.filesystem_id = isolated_context->RegisterFileSystemForPath( 328 result.filesystem_id = isolated_context->RegisterFileSystemForPath(
329 fileapi::kFileSystemTypeNativeForPlatformApp, path, 329 fileapi::kFileSystemTypeNativeForPlatformApp, path,
330 &result.registered_name); 330 &result.registered_name);
331 331
332 content::ChildProcessSecurityPolicy* policy = 332 content::ChildProcessSecurityPolicy* policy =
333 content::ChildProcessSecurityPolicy::GetInstance(); 333 content::ChildProcessSecurityPolicy::GetInstance();
334 policy->GrantReadFileSystem(renderer_id, result.filesystem_id); 334 policy->GrantReadFileSystem(renderer_id, result.filesystem_id);
335 if (HasFileSystemWritePermission(extension)) { 335 if (HasFileSystemWritePermission(extension)) {
336 policy->GrantWriteFileSystem(renderer_id, result.filesystem_id); 336 if (is_directory) {
337 policy->GrantDeleteFromFileSystem(renderer_id, result.filesystem_id); 337 policy->GrantCreateReadWriteFileSystem(renderer_id, result.filesystem_id);
338 if (is_directory) 338 } else {
339 policy->GrantCreateFileForFileSystem(renderer_id, result.filesystem_id); 339 policy->GrantWriteFileSystem(renderer_id, result.filesystem_id);
340 policy->GrantDeleteFromFileSystem(renderer_id, result.filesystem_id);
341 }
340 } 342 }
341 343
342 result.id = result.filesystem_id + ":" + result.registered_name; 344 result.id = result.filesystem_id + ":" + result.registered_name;
343 return result; 345 return result;
344 } 346 }
345 347
346 void CheckWritableFiles( 348 void CheckWritableFiles(
347 const std::vector<base::FilePath>& paths, 349 const std::vector<base::FilePath>& paths,
348 Profile* profile, 350 Profile* profile,
349 bool is_directory, 351 bool is_directory,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 *error = kInvalidParameters; 410 *error = kInvalidParameters;
409 return false; 411 return false;
410 } 412 }
411 413
412 return true; 414 return true;
413 } 415 }
414 416
415 } // namespace app_file_handler_util 417 } // namespace app_file_handler_util
416 418
417 } // namespace extensions 419 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698