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

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

Issue 10449028: Revert 138444 - Always pass FileSystemContext to ObfuscatedFileUtil operations (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1151/src/
Patch Set: 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
122 // We don't own this pointer; it's a magic singleton generated by the 119 // We don't own this pointer; it's a magic singleton generated by the
123 // profile's FileSystemContext. Deleting it would be a bad idea. 120 // profile's FileSystemContext. Deleting it would be a bad idea.
124 fileapi::FileSystemQuotaUtil* quota_util = 121 fileapi::FileSystemQuotaUtil* quota_util =
125 context->GetQuotaUtil(fileapi::kFileSystemTypeTemporary); 122 BrowserContext::GetFileSystemContext(profile_)->GetQuotaUtil(
123 fileapi::kFileSystemTypeTemporary);
126 124
127 GURL current; 125 GURL current;
128 126
129 while (!(current = origin_enumerator->Next()).is_empty()) { 127 while (!(current = origin_enumerator->Next()).is_empty()) {
130 if (!BrowsingDataHelper::HasValidScheme(current)) 128 if (!BrowsingDataHelper::HasValidScheme(current))
131 continue; // Non-websafe state is not considered browsing data. 129 continue; // Non-websafe state is not considered browsing data.
132 130
133 // We can call these synchronous methods as we've already verified that 131 // We can call these synchronous methods as we've already verified that
134 // we're running on the FILE thread. 132 // we're running on the FILE thread.
135 int64 persistent_usage = quota_util->GetOriginUsageOnFileThread( 133 int64 persistent_usage = quota_util->GetOriginUsageOnFileThread(current,
136 context, current,
137 fileapi::kFileSystemTypePersistent); 134 fileapi::kFileSystemTypePersistent);
138 int64 temporary_usage = quota_util->GetOriginUsageOnFileThread( 135 int64 temporary_usage = quota_util->GetOriginUsageOnFileThread(current,
139 context, current,
140 fileapi::kFileSystemTypeTemporary); 136 fileapi::kFileSystemTypeTemporary);
141 file_system_info_.push_back( 137 file_system_info_.push_back(
142 FileSystemInfo( 138 FileSystemInfo(
143 current, 139 current,
144 origin_enumerator->HasFileSystemType( 140 origin_enumerator->HasFileSystemType(
145 fileapi::kFileSystemTypePersistent), 141 fileapi::kFileSystemTypePersistent),
146 origin_enumerator->HasFileSystemType( 142 origin_enumerator->HasFileSystemType(
147 fileapi::kFileSystemTypeTemporary), 143 fileapi::kFileSystemTypeTemporary),
148 persistent_usage, 144 persistent_usage,
149 temporary_usage)); 145 temporary_usage));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); 274 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this));
279 } 275 }
280 276
281 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { 277 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() {
282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
283 DCHECK(is_fetching_); 279 DCHECK(is_fetching_);
284 completion_callback_.Run(file_system_info_); 280 completion_callback_.Run(file_system_info_);
285 completion_callback_.Reset(); 281 completion_callback_.Reset();
286 is_fetching_ = false; 282 is_fetching_ = false;
287 } 283 }
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