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

Side by Side Diff: webkit/fileapi/sandbox_mount_point_provider.cc

Issue 10873055: Changed FileSystemPointProvider::IsAcccessAllowed() to take a single FileSystemURL instead of a tri… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for typos from Kinuko's review. Sorry, I will look more closely at my own diff next time Created 8 years, 3 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
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 "webkit/fileapi/sandbox_mount_point_provider.h" 5 #include "webkit/fileapi/sandbox_mount_point_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if (file_system_options_.is_incognito()) 377 if (file_system_options_.is_incognito())
378 // TODO(kinuko): return an isolated temporary directory. 378 // TODO(kinuko): return an isolated temporary directory.
379 return FilePath(); 379 return FilePath();
380 380
381 if (!IsAllowedScheme(origin_url)) 381 if (!IsAllowedScheme(origin_url))
382 return FilePath(); 382 return FilePath();
383 383
384 return GetBaseDirectoryForOriginAndType(origin_url, type, create); 384 return GetBaseDirectoryForOriginAndType(origin_url, type, create);
385 } 385 }
386 386
387 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url, 387 bool SandboxMountPointProvider::IsAccessAllowed(const FileSystemURL& url) {
388 FileSystemType type, 388 FileSystemType type = url.type();
389 const FilePath& unused) {
390 if (type != kFileSystemTypeTemporary && type != kFileSystemTypePersistent) 389 if (type != kFileSystemTypeTemporary && type != kFileSystemTypePersistent)
391 return false; 390 return false;
392 // We essentially depend on quota to do our access controls, so here 391 // We essentially depend on quota to do our access controls, so here
393 // we only check if the requested scheme is allowed or not. 392 // we only check if the requested scheme is allowed or not.
394 return IsAllowedScheme(origin_url); 393 return IsAllowedScheme(url.origin());
395 } 394 }
396 395
397 bool SandboxMountPointProvider::IsRestrictedFileName(const FilePath& filename) 396 bool SandboxMountPointProvider::IsRestrictedFileName(const FilePath& filename)
398 const { 397 const {
399 if (filename.value().empty()) 398 if (filename.value().empty())
400 return false; 399 return false;
401 400
402 for (size_t i = 0; i < arraysize(kRestrictedNames); ++i) { 401 for (size_t i = 0; i < arraysize(kRestrictedNames); ++i) {
403 // Exact match. 402 // Exact match.
404 if (filename.value() == kRestrictedNames[i]) 403 if (filename.value() == kRestrictedNames[i])
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 break; 749 break;
751 case base::PLATFORM_FILE_ERROR_FAILED: 750 case base::PLATFORM_FILE_ERROR_FAILED:
752 default: 751 default:
753 REPORT(kUnknownError); 752 REPORT(kUnknownError);
754 break; 753 break;
755 } 754 }
756 #undef REPORT 755 #undef REPORT
757 } 756 }
758 757
759 } // namespace fileapi 758 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698