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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_file_system_helper.cc

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove useless headers. 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 "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browsing_data/browsing_data_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_helper.h"
15 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "webkit/fileapi/file_system_context.h" 16 #include "webkit/fileapi/file_system_context.h"
18 #include "webkit/fileapi/file_system_quota_util.h" 17 #include "webkit/fileapi/file_system_quota_util.h"
19 #include "webkit/fileapi/file_system_types.h" 18 #include "webkit/fileapi/file_system_types.h"
20 #include "webkit/fileapi/sandbox_mount_point_provider.h" 19 #include "webkit/fileapi/sandbox_mount_point_provider.h"
21 20
22 using content::BrowserContext;
23 using content::BrowserThread; 21 using content::BrowserThread;
24 22
23 namespace fileapi {
24 class FileSystemContext;
25 }
26
25 namespace { 27 namespace {
26 28
27 // An implementation of the BrowsingDataFileSystemHelper interface that pulls 29 // An implementation of the BrowsingDataFileSystemHelper interface that pulls
28 // data from a given |profile| and returns a list of FileSystemInfo items to a 30 // data from a given |filesystem_context| and returns a list of FileSystemInfo
29 // client. 31 // items to a client.
30 class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper { 32 class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper {
31 public: 33 public:
32 // BrowsingDataFileSystemHelper implementation 34 // BrowsingDataFileSystemHelper implementation
33 explicit BrowsingDataFileSystemHelperImpl(Profile* profile); 35 explicit BrowsingDataFileSystemHelperImpl(
36 fileapi::FileSystemContext* filesystem_context);
34 virtual void StartFetching(const base::Callback< 37 virtual void StartFetching(const base::Callback<
35 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; 38 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE;
36 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE; 39 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE;
37 40
38 private: 41 private:
39 virtual ~BrowsingDataFileSystemHelperImpl(); 42 virtual ~BrowsingDataFileSystemHelperImpl();
40 43
41 // Enumerates all filesystem files, storing the resulting list into 44 // Enumerates all filesystem files, storing the resulting list into
42 // file_system_file_ for later use. This must be called on the FILE thread. 45 // file_system_file_ for later use. This must be called on the FILE thread.
43 void FetchFileSystemInfoInFileThread(); 46 void FetchFileSystemInfoInFileThread();
(...skipping 26 matching lines...) Expand all
70 // Indicates whether or not we're currently fetching information: set to true 73 // Indicates whether or not we're currently fetching information: set to true
71 // when StartFetching is called on the UI thread, and reset to false when 74 // when StartFetching is called on the UI thread, and reset to false when
72 // NotifyOnUIThread triggers the success callback. 75 // NotifyOnUIThread triggers the success callback.
73 // This property only mutates on the UI thread. 76 // This property only mutates on the UI thread.
74 bool is_fetching_; 77 bool is_fetching_;
75 78
76 DISALLOW_COPY_AND_ASSIGN(BrowsingDataFileSystemHelperImpl); 79 DISALLOW_COPY_AND_ASSIGN(BrowsingDataFileSystemHelperImpl);
77 }; 80 };
78 81
79 BrowsingDataFileSystemHelperImpl::BrowsingDataFileSystemHelperImpl( 82 BrowsingDataFileSystemHelperImpl::BrowsingDataFileSystemHelperImpl(
80 Profile* profile) 83 fileapi::FileSystemContext* filesystem_context)
81 : filesystem_context_(BrowserContext::GetFileSystemContext(profile)), 84 : filesystem_context_(filesystem_context),
82 is_fetching_(false) { 85 is_fetching_(false) {
83 DCHECK(filesystem_context_); 86 DCHECK(filesystem_context_);
84 } 87 }
85 88
86 BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() { 89 BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() {
87 } 90 }
88 91
89 void BrowsingDataFileSystemHelperImpl::StartFetching( 92 void BrowsingDataFileSystemHelperImpl::StartFetching(
90 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) { 93 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 has_persistent(has_persistent), 180 has_persistent(has_persistent),
178 has_temporary(has_temporary), 181 has_temporary(has_temporary),
179 usage_persistent(usage_persistent), 182 usage_persistent(usage_persistent),
180 usage_temporary(usage_temporary) { 183 usage_temporary(usage_temporary) {
181 } 184 }
182 185
183 BrowsingDataFileSystemHelper::FileSystemInfo::~FileSystemInfo() {} 186 BrowsingDataFileSystemHelper::FileSystemInfo::~FileSystemInfo() {}
184 187
185 // static 188 // static
186 BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create( 189 BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create(
187 Profile* profile) { 190 fileapi::FileSystemContext* filesystem_context) {
188 return new BrowsingDataFileSystemHelperImpl(profile); 191 return new BrowsingDataFileSystemHelperImpl(filesystem_context);
189 } 192 }
190 193
191 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper( 194 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper(
192 Profile* profile) 195 Profile* profile)
193 : is_fetching_(false) { 196 : is_fetching_(false) {
194 } 197 }
195 198
196 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper() 199 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper()
197 : is_fetching_(false) { 200 : is_fetching_(false) {
198 } 201 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); 277 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this));
275 } 278 }
276 279
277 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { 280 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() {
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
279 DCHECK(is_fetching_); 282 DCHECK(is_fetching_);
280 completion_callback_.Run(file_system_info_); 283 completion_callback_.Run(file_system_info_);
281 completion_callback_.Reset(); 284 completion_callback_.Reset();
282 is_fetching_ = false; 285 is_fetching_ = false;
283 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698