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

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

Issue 5633008: Remove BrowserFileSystemContext class (merge into SandboxedFSContext) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sandboxed_file_system_context.h" 5 #include "webkit/fileapi/sandboxed_file_system_context.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "webkit/fileapi/file_system_path_manager.h" 9 #include "webkit/fileapi/file_system_path_manager.h"
10 #include "webkit/fileapi/file_system_quota_manager.h" 10 #include "webkit/fileapi/file_system_quota_manager.h"
11 11
12 namespace fileapi { 12 namespace fileapi {
13 13
14 SandboxedFileSystemContext::SandboxedFileSystemContext( 14 SandboxedFileSystemContext::SandboxedFileSystemContext(
15 scoped_refptr<base::MessageLoopProxy> file_message_loop, 15 scoped_refptr<base::MessageLoopProxy> file_message_loop,
16 scoped_refptr<base::MessageLoopProxy> io_message_loop,
16 const FilePath& profile_path, 17 const FilePath& profile_path,
17 bool is_incognito, 18 bool is_incognito,
18 bool allow_file_access, 19 bool allow_file_access,
19 bool unlimited_quota) 20 bool unlimited_quota)
20 : file_message_loop_(file_message_loop), 21 : file_message_loop_(file_message_loop),
22 io_message_loop_(io_message_loop),
21 path_manager_(new FileSystemPathManager( 23 path_manager_(new FileSystemPathManager(
22 file_message_loop, profile_path, is_incognito, allow_file_access)), 24 file_message_loop, profile_path, is_incognito, allow_file_access)),
23 quota_manager_(new FileSystemQuotaManager( 25 quota_manager_(new FileSystemQuotaManager(
24 allow_file_access, unlimited_quota)) { 26 allow_file_access, unlimited_quota)) {
25 } 27 }
26 28
27 SandboxedFileSystemContext::~SandboxedFileSystemContext() { 29 SandboxedFileSystemContext::~SandboxedFileSystemContext() {
28 } 30 }
29 31
30 void SandboxedFileSystemContext::Shutdown() { 32 void SandboxedFileSystemContext::Shutdown() {
33 DCHECK(io_message_loop_->BelongsToCurrentThread());
31 path_manager_.reset(); 34 path_manager_.reset();
32 quota_manager_.reset(); 35 quota_manager_.reset();
33 } 36 }
34 37
35 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread( 38 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread(
36 const GURL& origin_url) { 39 const GURL& origin_url) {
37 DCHECK(path_manager_.get()); 40 DCHECK(path_manager_.get());
38 DCHECK(file_message_loop_->BelongsToCurrentThread()); 41 DCHECK(file_message_loop_->BelongsToCurrentThread());
39 42
40 std::string storage_identifier = 43 std::string storage_identifier =
41 FileSystemPathManager::GetStorageIdentifierFromURL(origin_url); 44 FileSystemPathManager::GetStorageIdentifierFromURL(origin_url);
42 FilePath path_for_origin = path_manager_->base_path().AppendASCII( 45 FilePath path_for_origin = path_manager_->base_path().AppendASCII(
43 storage_identifier); 46 storage_identifier);
44 47
45 file_util::Delete(path_for_origin, true /* recursive */); 48 file_util::Delete(path_for_origin, true /* recursive */);
46 } 49 }
47 50
51 void SandboxedFileSystemContext::SetOriginQuotaUnlimited(const GURL& url) {
52 DCHECK(io_message_loop_->BelongsToCurrentThread());
53 quota_manager()->SetOriginQuotaUnlimited(url);
54 }
55
56 void SandboxedFileSystemContext::ResetOriginQuotaUnlimited(const GURL& url) {
57 DCHECK(io_message_loop_->BelongsToCurrentThread());
58 quota_manager()->ResetOriginQuotaUnlimited(url);
59 }
60
61 void SandboxedFileSystemContext::DeleteOnCorrectThread() const {
62 if (!io_message_loop_->BelongsToCurrentThread()) {
63 io_message_loop_->DeleteSoon(FROM_HERE, this);
64 return;
65 }
66 delete this;
67 }
68
48 } // namespace fileapi 69 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/sandboxed_file_system_context.h ('k') | webkit/fileapi/sandboxed_file_system_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698