OLD | NEW |
---|---|
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 "content/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "content/public/browser/session_storage_usage_info.h" | 29 #include "content/public/browser/session_storage_usage_info.h" |
30 #include "net/base/completion_callback.h" | 30 #include "net/base/completion_callback.h" |
31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
32 #include "net/cookies/canonical_cookie.h" | 32 #include "net/cookies/canonical_cookie.h" |
33 #include "net/cookies/cookie_monster.h" | 33 #include "net/cookies/cookie_monster.h" |
34 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
35 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
36 #include "storage/browser/database/database_tracker.h" | 36 #include "storage/browser/database/database_tracker.h" |
37 #include "storage/browser/quota/quota_manager.h" | 37 #include "storage/browser/quota/quota_manager.h" |
38 | 38 |
39 #if defined(ENABLE_PLUGINS) | |
40 #include "base/files/file_enumerator.h" | |
41 #include "base/stl_util.h" | |
42 #include "ppapi/shared_impl/ppapi_constants.h" | |
43 #include "storage/browser/fileapi/async_file_util.h" | |
44 #include "storage/browser/fileapi/async_file_util_adapter.h" | |
45 #include "storage/browser/fileapi/isolated_context.h" | |
46 #include "storage/browser/fileapi/obfuscated_file_util.h" | |
47 #include "storage/common/fileapi/file_system_util.h" | |
48 #endif // defined(ENABLE_PLUGINS) | |
49 | |
39 namespace content { | 50 namespace content { |
40 | 51 |
41 namespace { | 52 namespace { |
42 | 53 |
43 bool DoesCookieMatchHost(const std::string& host, | 54 bool DoesCookieMatchHost(const std::string& host, |
44 const net::CanonicalCookie& cookie) { | 55 const net::CanonicalCookie& cookie) { |
45 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); | 56 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); |
46 } | 57 } |
47 | 58 |
48 void OnClearedCookies(const base::Closure& callback, int num_deleted) { | 59 void OnClearedCookies(const base::Closure& callback, int num_deleted) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 const StoragePartition::OriginMatcherFunction& origin_matcher, | 219 const StoragePartition::OriginMatcherFunction& origin_matcher, |
209 const base::Closure& callback) { | 220 const base::Closure& callback) { |
210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 221 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
211 | 222 |
212 dom_storage_context->GetSessionStorageUsage( | 223 dom_storage_context->GetSessionStorageUsage( |
213 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, | 224 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, |
214 special_storage_policy, origin_matcher, | 225 special_storage_policy, origin_matcher, |
215 callback)); | 226 callback)); |
216 } | 227 } |
217 | 228 |
229 #if defined(ENABLE_PLUGINS) | |
230 // Helper for deleting plugin private data for a specified origin and plugin. | |
231 // If any file matches the time range specified, then all files for this | |
232 // origin and plugin are deleted. | |
233 // All of the operations in this class are done on the FILE thread. | |
234 class PluginPrivateDataByOriginDeletionHelper { | |
235 public: | |
236 PluginPrivateDataByOriginDeletionHelper( | |
237 storage::FileSystemContext* filesystem_context, | |
238 const GURL& origin, | |
239 const std::string& plugin_name, | |
240 const base::Time begin, | |
241 const base::Time end, | |
242 const base::Closure& callback) | |
243 : filesystem_context_(filesystem_context), | |
244 origin_(origin), | |
245 plugin_name_(plugin_name), | |
246 begin_(begin), | |
247 end_(end), | |
248 callback_(callback) { | |
249 // Create the filesystem ID. | |
250 fsid_ = storage::IsolatedContext::GetInstance() | |
251 ->RegisterFileSystemForVirtualPath( | |
252 storage::kFileSystemTypePluginPrivate, | |
253 ppapi::kPluginPrivateRootName, base::FilePath()); | |
254 } | |
255 ~PluginPrivateDataByOriginDeletionHelper() {} | |
256 | |
257 // Checks the files contained in the plugin private filesystem for |origin_| | |
258 // and |plugin_name_| and deletes any files whose last modified time is | |
259 // greater or equal to |begin_|. |callback_| is called when all actions | |
260 // are complete. | |
261 void Start(); | |
262 | |
263 private: | |
264 void OnFileSystemOpened(base::File::Error result); | |
265 void OnDirectoryRead(const std::string& root, | |
266 base::File::Error result, | |
267 const storage::AsyncFileUtil::EntryList& file_list, | |
268 bool has_more); | |
269 void OnFileInfo(const std::string& file_name, | |
270 base::File::Error result, | |
271 const base::File::Info& file_info); | |
272 | |
273 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
274 // |callback_| is called and this helper object is destroyed. | |
275 void IncrementTaskCount(); | |
276 void DecrementTaskCount(); | |
277 | |
278 // Not owned by this object. Caller is responsible for keeping the | |
279 // FileSystemContext alive until |callback_| is called. | |
280 storage::FileSystemContext* filesystem_context_; | |
281 | |
282 const GURL origin_; | |
283 const std::string plugin_name_; | |
284 const base::Time begin_; | |
285 const base::Time end_; | |
286 const base::Closure callback_; | |
287 std::string fsid_; | |
288 int task_count_ = 0; | |
289 bool delete_this_origin_data_ = false; | |
290 }; | |
291 | |
292 void PluginPrivateDataByOriginDeletionHelper::Start() { | |
293 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
294 DCHECK(storage::ValidateIsolatedFileSystemId(fsid_)); | |
295 | |
296 IncrementTaskCount(); | |
297 filesystem_context_->OpenPluginPrivateFileSystem( | |
298 origin_, storage::kFileSystemTypePluginPrivate, fsid_, plugin_name_, | |
299 storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, | |
300 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened, | |
301 base::Unretained(this))); | |
302 } | |
303 | |
304 void PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened( | |
305 base::File::Error result) { | |
306 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
307 DVLOG(3) << "Opened filesystem for " << origin_ << ":" << plugin_name_ | |
308 << ", result: " << result; | |
309 | |
310 // If we can't open the directory, we can't delete files so simply return. | |
311 if (result != base::File::FILE_OK) { | |
312 DecrementTaskCount(); | |
313 return; | |
314 } | |
315 | |
316 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
317 storage::kFileSystemTypePluginPrivate); | |
318 std::string root = storage::GetIsolatedFileSystemRootURIString( | |
319 origin_, fsid_, ppapi::kPluginPrivateRootName); | |
320 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
321 base::WrapUnique( | |
322 new storage::FileSystemOperationContext(filesystem_context_)); | |
323 file_util->ReadDirectory( | |
324 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), | |
325 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead, | |
326 base::Unretained(this), root)); | |
327 } | |
328 | |
329 void PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead( | |
330 const std::string& root, | |
331 base::File::Error result, | |
332 const storage::AsyncFileUtil::EntryList& file_list, | |
333 bool has_more) { | |
334 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
335 DVLOG(3) << __FUNCTION__ << " result: " << result | |
336 << ", #files: " << file_list.size(); | |
337 | |
338 // Quit if there is an error. | |
339 if (result != base::File::FILE_OK) { | |
340 DLOG(ERROR) << "Unable to read directory for " << origin_ << ":" | |
341 << plugin_name_; | |
342 DecrementTaskCount(); | |
343 return; | |
344 } | |
345 | |
346 // No error, process the files returned. No need to do this if we have | |
347 // already decided to delete all the data for this origin. | |
348 if (!delete_this_origin_data_) { | |
349 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
350 storage::kFileSystemTypePluginPrivate); | |
351 for (const auto& file : file_list) { | |
352 DVLOG(3) << __FUNCTION__ << " file: " << file.name; | |
353 DCHECK(!file.is_directory); // Nested directories not implemented. | |
354 | |
355 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
356 base::WrapUnique( | |
357 new storage::FileSystemOperationContext(filesystem_context_)); | |
358 storage::FileSystemURL file_url = | |
359 filesystem_context_->CrackURL(GURL(root + file.name)); | |
360 IncrementTaskCount(); | |
361 file_util->GetFileInfo( | |
362 std::move(operation_context), file_url, | |
363 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | | |
364 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | |
365 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileInfo, | |
366 base::Unretained(this), file.name)); | |
367 } | |
368 } | |
369 | |
370 // If there are more files in this directory, wait for the next call. | |
371 if (has_more) | |
372 return; | |
373 | |
374 DecrementTaskCount(); | |
375 } | |
376 | |
377 void PluginPrivateDataByOriginDeletionHelper::OnFileInfo( | |
378 const std::string& file_name, | |
379 base::File::Error result, | |
380 const base::File::Info& file_info) { | |
381 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
382 | |
383 if (result == base::File::FILE_OK) { | |
384 DVLOG(3) << __FUNCTION__ << " name: " << file_name | |
385 << ", size: " << file_info.size | |
386 << ", modified: " << file_info.last_modified; | |
387 if (file_info.last_modified >= begin_ && file_info.last_modified <= end_) | |
388 delete_this_origin_data_ = true; | |
389 } | |
390 | |
391 DecrementTaskCount(); | |
392 } | |
393 | |
394 void PluginPrivateDataByOriginDeletionHelper::IncrementTaskCount() { | |
395 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
396 ++task_count_; | |
397 } | |
398 | |
399 void PluginPrivateDataByOriginDeletionHelper::DecrementTaskCount() { | |
400 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
401 DCHECK_GT(task_count_, 0); | |
402 --task_count_; | |
403 if (task_count_) | |
404 return; | |
405 | |
406 // If there are no more tasks in progress, then delete the files for this | |
407 // origin if necessary. | |
408 if (delete_this_origin_data_) { | |
409 DVLOG(3) << "Deleting plugin data for " << origin_ << ":" << plugin_name_; | |
410 storage::FileSystemBackend* backend = | |
411 filesystem_context_->GetFileSystemBackend( | |
412 storage::kFileSystemTypePluginPrivate); | |
413 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
414 base::File::Error result = quota_util->DeleteOriginDataOnFileTaskRunner( | |
415 filesystem_context_, nullptr, origin_, | |
416 storage::kFileSystemTypePluginPrivate); | |
417 DLOG_IF(ERROR, result != base::File::FILE_OK) | |
418 << "Unable to delete the plugin data for " << origin_ << ":" | |
419 << plugin_name_; | |
420 } | |
421 | |
422 // Run |callback_| and then this helper can be deleted. | |
423 callback_.Run(); | |
424 delete this; | |
425 } | |
426 | |
427 // Helper for deleting the plugin private data. | |
428 // All of the operations in this class are done on the FILE thread. | |
429 class PluginPrivateDataDeletionHelper { | |
430 public: | |
431 PluginPrivateDataDeletionHelper( | |
432 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
433 const base::Time begin, | |
434 const base::Time end, | |
435 const base::Closure& callback) | |
436 : filesystem_context_(std::move(filesystem_context)), | |
437 begin_(begin), | |
438 end_(end), | |
439 callback_(callback) {} | |
440 ~PluginPrivateDataDeletionHelper() {} | |
441 | |
442 void CheckOrigins(const std::set<GURL>& origins); | |
443 | |
444 private: | |
445 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
446 // |callback_| is called and this helper object is destroyed. | |
447 void IncrementTaskCount(); | |
448 void DecrementTaskCount(); | |
449 | |
450 // Keep a reference to FileSystemContext until we are done with it. | |
451 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
452 | |
453 const base::Time begin_; | |
454 const base::Time end_; | |
455 const base::Closure callback_; | |
456 int task_count_ = 0; | |
457 }; | |
458 | |
459 void PluginPrivateDataDeletionHelper::CheckOrigins( | |
460 const std::set<GURL>& origins) { | |
461 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
462 IncrementTaskCount(); | |
463 | |
464 base::Closure decrement_callback = | |
465 base::Bind(&PluginPrivateDataDeletionHelper::DecrementTaskCount, | |
466 base::Unretained(this)); | |
467 storage::AsyncFileUtil* async_file_util = | |
468 filesystem_context_->GetAsyncFileUtil( | |
469 storage::kFileSystemTypePluginPrivate); | |
470 storage::ObfuscatedFileUtil* obfuscated_file_util = | |
471 static_cast<storage::ObfuscatedFileUtil*>( | |
472 static_cast<storage::AsyncFileUtilAdapter*>(async_file_util) | |
473 ->sync_file_util()); | |
474 for (const auto& origin : origins) { | |
475 // Determine the available plugin private filesystem directories | |
476 // for this origin. | |
477 base::File::Error error; | |
478 base::FilePath path = obfuscated_file_util->GetDirectoryForOriginAndType( | |
479 origin, "", false, &error); | |
480 if (error != base::File::FILE_OK) { | |
481 DLOG(ERROR) << "Unable to read directory for " << origin; | |
482 continue; | |
483 } | |
484 | |
485 // Currently the plugin private filesystem is only used by Encrypted | |
486 // Media Content Decryption Modules, which are treated as pepper plugins. | |
487 // Each CDM gets a directory based on the mimetype (e.g. plugin | |
488 // application/x-ppapi-widevine-cdm uses directory | |
489 // application_x-ppapi-widevine-cdm). Enumerate through the set of | |
490 // directories so that data from any CDM used by this origin is deleted. | |
491 base::FileEnumerator file_enumerator(path, false, | |
492 base::FileEnumerator::DIRECTORIES); | |
493 for (base::FilePath plugin_path = file_enumerator.Next(); | |
494 !plugin_path.empty(); plugin_path = file_enumerator.Next()) { | |
495 IncrementTaskCount(); | |
496 PluginPrivateDataByOriginDeletionHelper* helper = | |
497 new PluginPrivateDataByOriginDeletionHelper( | |
498 filesystem_context_.get(), origin.GetOrigin(), | |
499 plugin_path.BaseName().MaybeAsASCII(), begin_, end_, | |
500 decrement_callback); | |
501 helper->Start(); | |
502 // |helper| will delete itself when it is done. | |
503 } | |
504 } | |
505 | |
506 // Cancels out the call to IncrementTaskCount() at the start of this method. | |
507 // If there are no origins specified then this will cause this helper to | |
508 // be destroyed. | |
509 DecrementTaskCount(); | |
510 } | |
511 | |
512 void PluginPrivateDataDeletionHelper::IncrementTaskCount() { | |
513 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
514 ++task_count_; | |
515 } | |
516 | |
517 void PluginPrivateDataDeletionHelper::DecrementTaskCount() { | |
518 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
519 DCHECK_GT(task_count_, 0); | |
520 --task_count_; | |
521 if (task_count_) | |
522 return; | |
523 | |
524 // If there are no more tasks in progress, run |callback_| and then | |
525 // this helper can be deleted. | |
526 callback_.Run(); | |
527 delete this; | |
528 } | |
529 | |
530 void ClearPluginPrivateDataOnFileThread( | |
531 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
532 const GURL& storage_origin, | |
533 const base::Time begin, | |
534 const base::Time end, | |
535 const base::Closure& callback) { | |
536 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
537 DVLOG(3) << "Clearing plugin data for origin: " << storage_origin; | |
538 | |
539 storage::FileSystemBackend* backend = | |
540 filesystem_context->GetFileSystemBackend( | |
541 storage::kFileSystemTypePluginPrivate); | |
542 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
543 | |
544 // Determine the set of origins used. | |
545 std::set<GURL> origins; | |
546 quota_util->GetOriginsForTypeOnFileTaskRunner( | |
547 storage::kFileSystemTypePluginPrivate, &origins); | |
548 | |
549 if (origins.empty()) { | |
550 // No origins, so nothing to do. | |
551 callback.Run(); | |
552 return; | |
553 } | |
554 | |
555 // If a specific origin is provided, then check that it is in the list | |
556 // returned and remove all the other origins. | |
557 if (!storage_origin.is_empty()) { | |
558 if (!ContainsKey(origins, storage_origin)) { | |
559 // Nothing matches, so nothing to do. | |
560 callback.Run(); | |
561 return; | |
562 } | |
563 | |
564 // List should only contain the one value that matches. | |
565 origins.clear(); | |
566 origins.insert(storage_origin); | |
567 } | |
568 | |
569 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( | |
570 std::move(filesystem_context), begin, end, callback); | |
571 helper->CheckOrigins(origins); | |
572 // |helper| will delete itself when all origins have been checked. | |
573 } | |
574 #endif // defined(ENABLE_PLUGINS) | |
575 | |
218 } // namespace | 576 } // namespace |
219 | 577 |
220 // Static. | 578 // Static. |
221 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { | 579 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { |
222 int quota_client_mask = 0; | 580 int quota_client_mask = 0; |
223 | 581 |
224 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) | 582 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) |
225 quota_client_mask |= storage::QuotaClient::kFileSystem; | 583 quota_client_mask |= storage::QuotaClient::kFileSystem; |
226 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) | 584 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) |
227 quota_client_mask |= storage::QuotaClient::kDatabase; | 585 quota_client_mask |= storage::QuotaClient::kDatabase; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 void ClearDataOnUIThread( | 667 void ClearDataOnUIThread( |
310 const GURL& storage_origin, | 668 const GURL& storage_origin, |
311 const OriginMatcherFunction& origin_matcher, | 669 const OriginMatcherFunction& origin_matcher, |
312 const CookieMatcherFunction& cookie_matcher, | 670 const CookieMatcherFunction& cookie_matcher, |
313 const base::FilePath& path, | 671 const base::FilePath& path, |
314 net::URLRequestContextGetter* rq_context, | 672 net::URLRequestContextGetter* rq_context, |
315 DOMStorageContextWrapper* dom_storage_context, | 673 DOMStorageContextWrapper* dom_storage_context, |
316 storage::QuotaManager* quota_manager, | 674 storage::QuotaManager* quota_manager, |
317 storage::SpecialStoragePolicy* special_storage_policy, | 675 storage::SpecialStoragePolicy* special_storage_policy, |
318 WebRTCIdentityStore* webrtc_identity_store, | 676 WebRTCIdentityStore* webrtc_identity_store, |
677 storage::FileSystemContext* filesystem_context, | |
319 const base::Time begin, | 678 const base::Time begin, |
320 const base::Time end); | 679 const base::Time end); |
321 | 680 |
322 void ClearQuotaManagedDataOnIOThread( | 681 void ClearQuotaManagedDataOnIOThread( |
323 const scoped_refptr<storage::QuotaManager>& quota_manager, | 682 const scoped_refptr<storage::QuotaManager>& quota_manager, |
324 const base::Time begin, | 683 const base::Time begin, |
325 const GURL& storage_origin, | 684 const GURL& storage_origin, |
326 const scoped_refptr<storage::SpecialStoragePolicy>& | 685 const scoped_refptr<storage::SpecialStoragePolicy>& |
327 special_storage_policy, | 686 special_storage_policy, |
328 const StoragePartition::OriginMatcherFunction& origin_matcher, | 687 const StoragePartition::OriginMatcherFunction& origin_matcher, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 const base::Closure& callback) { | 987 const base::Closure& callback) { |
629 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 988 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, | 989 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, |
631 quota_storage_remove_mask, | 990 quota_storage_remove_mask, |
632 callback); | 991 callback); |
633 // |helper| deletes itself when done in | 992 // |helper| deletes itself when done in |
634 // DataDeletionHelper::DecrementTaskCountOnUI(). | 993 // DataDeletionHelper::DecrementTaskCountOnUI(). |
635 helper->ClearDataOnUIThread( | 994 helper->ClearDataOnUIThread( |
636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, | 995 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
637 dom_storage_context_.get(), quota_manager_.get(), | 996 dom_storage_context_.get(), quota_manager_.get(), |
638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); | 997 special_storage_policy_.get(), webrtc_identity_store_.get(), |
998 filesystem_context_.get(), begin, end); | |
639 } | 999 } |
640 | 1000 |
641 void StoragePartitionImpl:: | 1001 void StoragePartitionImpl:: |
642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { | 1002 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { |
643 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1003 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
644 ++task_count; | 1004 ++task_count; |
645 } | 1005 } |
646 | 1006 |
647 void StoragePartitionImpl:: | 1007 void StoragePartitionImpl:: |
648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { | 1008 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( | 1128 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
769 const GURL& storage_origin, | 1129 const GURL& storage_origin, |
770 const OriginMatcherFunction& origin_matcher, | 1130 const OriginMatcherFunction& origin_matcher, |
771 const CookieMatcherFunction& cookie_matcher, | 1131 const CookieMatcherFunction& cookie_matcher, |
772 const base::FilePath& path, | 1132 const base::FilePath& path, |
773 net::URLRequestContextGetter* rq_context, | 1133 net::URLRequestContextGetter* rq_context, |
774 DOMStorageContextWrapper* dom_storage_context, | 1134 DOMStorageContextWrapper* dom_storage_context, |
775 storage::QuotaManager* quota_manager, | 1135 storage::QuotaManager* quota_manager, |
776 storage::SpecialStoragePolicy* special_storage_policy, | 1136 storage::SpecialStoragePolicy* special_storage_policy, |
777 WebRTCIdentityStore* webrtc_identity_store, | 1137 WebRTCIdentityStore* webrtc_identity_store, |
1138 storage::FileSystemContext* filesystem_context, | |
778 const base::Time begin, | 1139 const base::Time begin, |
779 const base::Time end) { | 1140 const base::Time end) { |
780 DCHECK_NE(remove_mask, 0u); | 1141 DCHECK_NE(remove_mask, 0u); |
781 DCHECK(!callback.is_null()); | 1142 DCHECK(!callback.is_null()); |
782 | 1143 |
783 IncrementTaskCountOnUI(); | 1144 IncrementTaskCountOnUI(); |
784 base::Closure decrement_callback = base::Bind( | 1145 base::Closure decrement_callback = base::Bind( |
785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); | 1146 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); |
786 | 1147 |
787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { | 1148 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 BrowserThread::PostTask( | 1209 BrowserThread::PostTask( |
849 BrowserThread::IO, | 1210 BrowserThread::IO, |
850 FROM_HERE, | 1211 FROM_HERE, |
851 base::Bind(&WebRTCIdentityStore::DeleteBetween, | 1212 base::Bind(&WebRTCIdentityStore::DeleteBetween, |
852 webrtc_identity_store, | 1213 webrtc_identity_store, |
853 begin, | 1214 begin, |
854 end, | 1215 end, |
855 decrement_callback)); | 1216 decrement_callback)); |
856 } | 1217 } |
857 | 1218 |
1219 #if defined(ENABLE_PLUGINS) | |
1220 if (remove_mask & REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA) { | |
1221 IncrementTaskCountOnUI(); | |
1222 BrowserThread::PostTask( | |
kinuko
2016/05/25 08:57:53
Should this use filesystem_context->default_file_t
jrummell
2016/05/26 00:35:10
This seems correct (as GetOriginsForTypeOnFileTask
jrummell
2016/05/26 01:23:29
I did some more looking at the code, and it looks
| |
1223 BrowserThread::FILE, FROM_HERE, | |
1224 base::Bind(&ClearPluginPrivateDataOnFileThread, | |
1225 make_scoped_refptr(filesystem_context), storage_origin, | |
1226 begin, end, decrement_callback)); | |
1227 } | |
1228 #endif // defined(ENABLE_PLUGINS) | |
1229 | |
858 DecrementTaskCountOnUI(); | 1230 DecrementTaskCountOnUI(); |
859 } | 1231 } |
860 | 1232 |
861 void StoragePartitionImpl::ClearDataForOrigin( | 1233 void StoragePartitionImpl::ClearDataForOrigin( |
862 uint32_t remove_mask, | 1234 uint32_t remove_mask, |
863 uint32_t quota_storage_remove_mask, | 1235 uint32_t quota_storage_remove_mask, |
864 const GURL& storage_origin, | 1236 const GURL& storage_origin, |
865 net::URLRequestContextGetter* request_context_getter, | 1237 net::URLRequestContextGetter* request_context_getter, |
866 const base::Closure& callback) { | 1238 const base::Closure& callback) { |
867 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1239 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 net::URLRequestContextGetter* url_request_context) { | 1301 net::URLRequestContextGetter* url_request_context) { |
930 url_request_context_ = url_request_context; | 1302 url_request_context_ = url_request_context; |
931 } | 1303 } |
932 | 1304 |
933 void StoragePartitionImpl::SetMediaURLRequestContext( | 1305 void StoragePartitionImpl::SetMediaURLRequestContext( |
934 net::URLRequestContextGetter* media_url_request_context) { | 1306 net::URLRequestContextGetter* media_url_request_context) { |
935 media_url_request_context_ = media_url_request_context; | 1307 media_url_request_context_ = media_url_request_context; |
936 } | 1308 } |
937 | 1309 |
938 } // namespace content | 1310 } // namespace content |
OLD | NEW |