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

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: Fix for typos from Kinuko's review. Sorry, I will look more closely at my own diff next time Created 8 years, 4 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(
91 fileapi::FileSystemType type, 91 const fileapi::FileSystemURL& url) {
92 const FilePath& virtual_path) {
93 // TODO(kinuko): this should call CanHandleURL() once 92 // TODO(kinuko): this should call CanHandleURL() once
94 // http://crbug.com/142267 is fixed. 93 // http://crbug.com/142267 is fixed.
95 if (type != fileapi::kFileSystemTypeNativeLocal && 94 if (url.type() != fileapi::kFileSystemTypeNativeLocal &&
96 type != fileapi::kFileSystemTypeDrive) 95 url.type() != fileapi::kFileSystemTypeDrive)
97 return false; 96 return false;
98 97
99 // Permit access to mount points from internal WebUI. 98 // Permit access to mount points from internal WebUI.
99 const GURL& origin_url = url.origin();
100 if (origin_url.SchemeIs(kChromeUIScheme)) 100 if (origin_url.SchemeIs(kChromeUIScheme))
101 return true; 101 return true;
102 102
103 std::string extension_id = origin_url.host(); 103 std::string extension_id = origin_url.host();
104 // Check first to make sure this extension has fileBrowserHander permissions. 104 // Check first to make sure this extension has fileBrowserHander permissions.
105 if (!special_storage_policy_->IsFileHandler(extension_id)) 105 if (!special_storage_policy_->IsFileHandler(extension_id))
106 return false; 106 return false;
107 107
108 return file_access_permissions_->HasAccessPermission(extension_id, 108 return file_access_permissions_->HasAccessPermission(extension_id,
109 virtual_path); 109 url.virtual_path());
110 } 110 }
111 111
112 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl. 112 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl.
113 bool CrosMountPointProvider::IsRestrictedFileName(const FilePath& path) const { 113 bool CrosMountPointProvider::IsRestrictedFileName(const FilePath& path) const {
114 return false; 114 return false;
115 } 115 }
116 116
117 fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() { 117 fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() {
118 // No quota support. 118 // No quota support.
119 return NULL; 119 return NULL;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 return iter->first.DirName().AppendRelativePath( 280 return iter->first.DirName().AppendRelativePath(
281 filesystem_path, virtual_path); 281 filesystem_path, virtual_path);
282 } 282 }
283 283
284 fileapi::IsolatedContext* CrosMountPointProvider::isolated_context() const { 284 fileapi::IsolatedContext* CrosMountPointProvider::isolated_context() const {
285 return fileapi::IsolatedContext::GetInstance(); 285 return fileapi::IsolatedContext::GetInstance();
286 } 286 }
287 287
288 } // namespace chromeos 288 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698