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

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

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix etc Created 7 years, 8 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 | « webkit/fileapi/sandbox_mount_point_provider.h ('k') | webkit/fileapi/sandbox_quota_observer.cc » ('j') | 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 "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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // this method is called or not. 124 // this method is called or not.
125 } 125 }
126 126
127 } // anonymous namespace 127 } // anonymous namespace
128 128
129 const base::FilePath::CharType 129 const base::FilePath::CharType
130 SandboxMountPointProvider::kFileSystemDirectory[] = 130 SandboxMountPointProvider::kFileSystemDirectory[] =
131 FILE_PATH_LITERAL("File System"); 131 FILE_PATH_LITERAL("File System");
132 132
133 // static 133 // static
134 bool SandboxMountPointProvider::CanHandleType(FileSystemType type) { 134 bool SandboxMountPointProvider::IsSandboxType(FileSystemType type) {
135 return type == kFileSystemTypeTemporary || 135 return type == kFileSystemTypeTemporary ||
136 type == kFileSystemTypePersistent || 136 type == kFileSystemTypePersistent ||
137 type == kFileSystemTypeSyncable; 137 type == kFileSystemTypeSyncable;
138 } 138 }
139 139
140 SandboxMountPointProvider::SandboxMountPointProvider( 140 SandboxMountPointProvider::SandboxMountPointProvider(
141 quota::QuotaManagerProxy* quota_manager_proxy, 141 quota::QuotaManagerProxy* quota_manager_proxy,
142 base::SequencedTaskRunner* file_task_runner, 142 base::SequencedTaskRunner* file_task_runner,
143 const base::FilePath& profile_path, 143 const base::FilePath& profile_path,
144 const FileSystemOptions& file_system_options) 144 const FileSystemOptions& file_system_options)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 file_system_usage_cache_.release(); 181 file_system_usage_cache_.release();
182 if (!file_task_runner_->DeleteSoon(FROM_HERE, sandbox_file_util)) 182 if (!file_task_runner_->DeleteSoon(FROM_HERE, sandbox_file_util))
183 delete sandbox_file_util; 183 delete sandbox_file_util;
184 if (!file_task_runner_->DeleteSoon(FROM_HERE, quota_observer)) 184 if (!file_task_runner_->DeleteSoon(FROM_HERE, quota_observer))
185 delete quota_observer; 185 delete quota_observer;
186 if (!file_task_runner_->DeleteSoon(FROM_HERE, file_system_usage_cache)) 186 if (!file_task_runner_->DeleteSoon(FROM_HERE, file_system_usage_cache))
187 delete file_system_usage_cache; 187 delete file_system_usage_cache;
188 } 188 }
189 } 189 }
190 190
191 bool SandboxMountPointProvider::CanHandleType(FileSystemType type) const {
192 return IsSandboxType(type);
193 }
194
191 void SandboxMountPointProvider::ValidateFileSystemRoot( 195 void SandboxMountPointProvider::ValidateFileSystemRoot(
192 const GURL& origin_url, fileapi::FileSystemType type, bool create, 196 const GURL& origin_url, fileapi::FileSystemType type, bool create,
193 const ValidateFileSystemCallback& callback) { 197 const ValidateFileSystemCallback& callback) {
194 if (file_system_options_.is_incognito()) { 198 if (file_system_options_.is_incognito()) {
195 // TODO(kinuko): return an isolated temporary directory. 199 // TODO(kinuko): return an isolated temporary directory.
196 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); 200 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
197 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, 201 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel,
198 kIncognito, 202 kIncognito,
199 kFileSystemErrorMax); 203 kFileSystemErrorMax);
200 return; 204 return;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 FileSystemType type, 641 FileSystemType type,
638 FileSystemUsageCache* usage_cache) { 642 FileSystemUsageCache* usage_cache) {
639 base::PlatformFileError error = base::PLATFORM_FILE_OK; 643 base::PlatformFileError error = base::PLATFORM_FILE_OK;
640 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType( 644 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType(
641 file_util, origin, type, &error); 645 file_util, origin, type, &error);
642 if (error == base::PLATFORM_FILE_OK) 646 if (error == base::PLATFORM_FILE_OK)
643 usage_cache->IncrementDirty(usage_cache_path); 647 usage_cache->IncrementDirty(usage_cache_path);
644 } 648 }
645 649
646 } // namespace fileapi 650 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.h ('k') | webkit/fileapi/sandbox_quota_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698