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

Side by Side Diff: webkit/chromeos/fileapi/cros_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: Rebase 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/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include "base/chromeos/chromeos_version.h" 7 #include "base/chromeos/chromeos_version.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (!url.is_valid()) 80 if (!url.is_valid())
81 return FilePath(); 81 return FilePath();
82 82
83 FilePath root_path; 83 FilePath root_path;
84 if (!isolated_context()->GetRegisteredPath(url.filesystem_id(), &root_path)) 84 if (!isolated_context()->GetRegisteredPath(url.filesystem_id(), &root_path))
85 return FilePath(); 85 return FilePath();
86 86
87 return root_path.DirName(); 87 return root_path.DirName();
88 } 88 }
89 89
90 bool CrosMountPointProvider::IsAccessAllowed(const GURL& origin_url, 90 bool CrosMountPointProvider::IsAccessAllowed(const fileapi::FileSystemURL& ur) {
kinuko 2012/08/24 10:17:44 typo: ur -> url
calvinlo 2012/08/25 13:18:10 Done.
91 fileapi::FileSystemType type,
92 const FilePath& virtual_path) {
93 // TODO(kinuko): this should call CanHandleURL() once 91 // TODO(kinuko): this should call CanHandleURL() once
94 // http://crbug.com/142267 is fixed. 92 // http://crbug.com/142267 is fixed.
95 if (type != fileapi::kFileSystemTypeNativeLocal && 93 if (url.type() != fileapi::kFileSystemTypeNativeLocal &&
96 type != fileapi::kFileSystemTypeDrive) 94 url.type() != fileapi::kFileSystemTypeDrive)
97 return false; 95 return false;
98 96
99 // Permit access to mount points from internal WebUI. 97 // Permit access to mount points from internal WebUI.
98 const GURL& origin_url = url.origin();
100 if (origin_url.SchemeIs(kChromeUIScheme)) 99 if (origin_url.SchemeIs(kChromeUIScheme))
101 return true; 100 return true;
102 101
103 std::string extension_id = origin_url.host(); 102 std::string extension_id = origin_url.host();
104 // Check first to make sure this extension has fileBrowserHander permissions. 103 // Check first to make sure this extension has fileBrowserHander permissions.
105 if (!special_storage_policy_->IsFileHandler(extension_id)) 104 if (!special_storage_policy_->IsFileHandler(extension_id))
106 return false; 105 return false;
107 106
108 return file_access_permissions_->HasAccessPermission(extension_id, 107 return file_access_permissions_->HasAccessPermission(extension_id,
109 virtual_path); 108 url.path());
kinuko 2012/08/24 10:17:44 url.path() -> url.virtual_path()
calvinlo 2012/08/25 13:18:10 Fixed. Sorry I should have looked at the diff more
110 } 109 }
111 110
112 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl. 111 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl.
113 bool CrosMountPointProvider::IsRestrictedFileName(const FilePath& path) const { 112 bool CrosMountPointProvider::IsRestrictedFileName(const FilePath& path) const {
114 return false; 113 return false;
115 } 114 }
116 115
117 fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() { 116 fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() {
118 // No quota support. 117 // No quota support.
119 return NULL; 118 return NULL;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 278 }
280 return iter->first.DirName().AppendRelativePath( 279 return iter->first.DirName().AppendRelativePath(
281 filesystem_path, virtual_path); 280 filesystem_path, virtual_path);
282 } 281 }
283 282
284 fileapi::IsolatedContext* CrosMountPointProvider::isolated_context() const { 283 fileapi::IsolatedContext* CrosMountPointProvider::isolated_context() const {
285 return fileapi::IsolatedContext::GetInstance(); 284 return fileapi::IsolatedContext::GetInstance();
286 } 285 }
287 286
288 } // namespace chromeos 287 } // namespace chromeos
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/cros_mount_point_provider.h ('k') | webkit/fileapi/file_system_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698