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

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

Issue 10407115: Always pass FileSystemContext to ObfuscatedFileUtil operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 7 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 | « no previous file | webkit/fileapi/file_system_context.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 "chrome/browser/browsing_data_file_system_helper.h" 5 #include "chrome/browser/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"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 &BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread, 109 &BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread,
110 this, origin)); 110 this, origin));
111 } 111 }
112 112
113 void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread() { 113 void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread() {
114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
115 scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator> 115 scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator>
116 origin_enumerator(BrowserContext::GetFileSystemContext(profile_)-> 116 origin_enumerator(BrowserContext::GetFileSystemContext(profile_)->
117 sandbox_provider()->CreateOriginEnumerator()); 117 sandbox_provider()->CreateOriginEnumerator());
118 118
119 scoped_refptr<fileapi::FileSystemContext> context =
120 BrowserContext::GetFileSystemContext(profile_);
121
119 // We don't own this pointer; it's a magic singleton generated by the 122 // We don't own this pointer; it's a magic singleton generated by the
120 // profile's FileSystemContext. Deleting it would be a bad idea. 123 // profile's FileSystemContext. Deleting it would be a bad idea.
121 fileapi::FileSystemQuotaUtil* quota_util = 124 fileapi::FileSystemQuotaUtil* quota_util =
122 BrowserContext::GetFileSystemContext(profile_)->GetQuotaUtil( 125 context->GetQuotaUtil(fileapi::kFileSystemTypeTemporary);
123 fileapi::kFileSystemTypeTemporary);
124 126
125 GURL current; 127 GURL current;
126 128
127 while (!(current = origin_enumerator->Next()).is_empty()) { 129 while (!(current = origin_enumerator->Next()).is_empty()) {
128 if (!BrowsingDataHelper::HasValidScheme(current)) 130 if (!BrowsingDataHelper::HasValidScheme(current))
129 continue; // Non-websafe state is not considered browsing data. 131 continue; // Non-websafe state is not considered browsing data.
130 132
131 // We can call these synchronous methods as we've already verified that 133 // We can call these synchronous methods as we've already verified that
132 // we're running on the FILE thread. 134 // we're running on the FILE thread.
133 int64 persistent_usage = quota_util->GetOriginUsageOnFileThread(current, 135 int64 persistent_usage = quota_util->GetOriginUsageOnFileThread(
136 context, current,
134 fileapi::kFileSystemTypePersistent); 137 fileapi::kFileSystemTypePersistent);
135 int64 temporary_usage = quota_util->GetOriginUsageOnFileThread(current, 138 int64 temporary_usage = quota_util->GetOriginUsageOnFileThread(
139 context, current,
136 fileapi::kFileSystemTypeTemporary); 140 fileapi::kFileSystemTypeTemporary);
137 file_system_info_.push_back( 141 file_system_info_.push_back(
138 FileSystemInfo( 142 FileSystemInfo(
139 current, 143 current,
140 origin_enumerator->HasFileSystemType( 144 origin_enumerator->HasFileSystemType(
141 fileapi::kFileSystemTypePersistent), 145 fileapi::kFileSystemTypePersistent),
142 origin_enumerator->HasFileSystemType( 146 origin_enumerator->HasFileSystemType(
143 fileapi::kFileSystemTypeTemporary), 147 fileapi::kFileSystemTypeTemporary),
144 persistent_usage, 148 persistent_usage,
145 temporary_usage)); 149 temporary_usage));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); 278 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this));
275 } 279 }
276 280
277 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { 281 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() {
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
279 DCHECK(is_fetching_); 283 DCHECK(is_fetching_);
280 completion_callback_.Run(file_system_info_); 284 completion_callback_.Run(file_system_info_);
281 completion_callback_.Reset(); 285 completion_callback_.Reset();
282 is_fetching_ = false; 286 is_fetching_ = false;
283 } 287 }
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698