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

Side by Side Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && 82 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) &&
83 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { 83 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) {
84 return FilePath(); 84 return FilePath();
85 } 85 }
86 86
87 return root_path.DirName(); 87 return root_path.DirName();
88 } 88 }
89 89
90 bool CrosMountPointProvider::IsAccessAllowed( 90 bool CrosMountPointProvider::IsAccessAllowed(
91 const fileapi::FileSystemURL& url) { 91 const fileapi::FileSystemURL& url) {
92 if (!CanHandleURL(url)) 92 if (!url.is_valid())
93 return false; 93 return false;
94 94
95 // No extra check is needed for isolated file systems.
96 if (url.mount_type() == fileapi::kFileSystemTypeIsolated)
97 return true;
98
99 // Permit access to mount points from internal WebUI. 95 // Permit access to mount points from internal WebUI.
100 const GURL& origin_url = url.origin(); 96 const GURL& origin_url = url.origin();
101 if (origin_url.SchemeIs(kChromeUIScheme)) 97 if (origin_url.SchemeIs(kChromeUIScheme))
102 return true; 98 return true;
103 99
100 // No extra check is needed for isolated file systems.
101 if (url.mount_type() == fileapi::kFileSystemTypeIsolated)
102 return true;
103
104 if (!CanHandleURL(url))
105 return false;
106
104 std::string extension_id = origin_url.host(); 107 std::string extension_id = origin_url.host();
105 // Check first to make sure this extension has fileBrowserHander permissions. 108 // Check first to make sure this extension has fileBrowserHander permissions.
106 if (!special_storage_policy_->IsFileHandler(extension_id)) 109 if (!special_storage_policy_->IsFileHandler(extension_id))
107 return false; 110 return false;
108 111
109 return file_access_permissions_->HasAccessPermission(extension_id, 112 return file_access_permissions_->HasAccessPermission(extension_id,
110 url.virtual_path()); 113 url.virtual_path());
111 } 114 }
112 115
113 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl. 116 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 fileapi::RemoteFileSystemProxyInterface* CrosMountPointProvider::GetRemoteProxy( 315 fileapi::RemoteFileSystemProxyInterface* CrosMountPointProvider::GetRemoteProxy(
313 const std::string& mount_name) const { 316 const std::string& mount_name) const {
314 fileapi::RemoteFileSystemProxyInterface* proxy = 317 fileapi::RemoteFileSystemProxyInterface* proxy =
315 mount_points_->GetRemoteFileSystemProxy(mount_name); 318 mount_points_->GetRemoteFileSystemProxy(mount_name);
316 if (proxy) 319 if (proxy)
317 return proxy; 320 return proxy;
318 return system_mount_points_->GetRemoteFileSystemProxy(mount_name); 321 return system_mount_points_->GetRemoteFileSystemProxy(mount_name);
319 } 322 }
320 323
321 } // namespace chromeos 324 } // namespace chromeos
OLDNEW
« no previous file with comments | « webkit/blob/blob_url_request_job_unittest.cc ('k') | webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698