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::Callback<void(bool, GURL)>& 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 StartOnFileThread(); | |
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::Callback<void(bool, GURL)> callback_; | |
287 std::string fsid_; | |
288 int task_count_ = 0; | |
289 bool delete_this_origin_data_ = false; | |
290 }; | |
291 | |
292 void PluginPrivateDataByOriginDeletionHelper::StartOnFileThread() { | |
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 run |callback_| on the | |
407 // proper thread. | |
408 filesystem_context_->default_file_task_runner()->PostTask( | |
409 FROM_HERE, base::Bind(callback_, delete_this_origin_data_, origin_)); | |
410 delete this; | |
411 } | |
412 | |
413 // Helper for deleting the plugin private data. | |
414 // All of the operations in this class are done on the FILE thread. | |
415 class PluginPrivateDataDeletionHelper { | |
416 public: | |
417 PluginPrivateDataDeletionHelper( | |
418 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
419 const base::Time begin, | |
420 const base::Time end, | |
421 const base::Closure& callback) | |
422 : filesystem_context_(std::move(filesystem_context)), | |
423 begin_(begin), | |
424 end_(end), | |
425 callback_(callback) {} | |
426 ~PluginPrivateDataDeletionHelper() {} | |
427 | |
428 void CheckOriginsOnFileTaskRunner(const std::set<GURL>& origins); | |
429 | |
430 private: | |
431 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
432 // |callback_| is called and this helper object is destroyed. | |
433 void IncrementTaskCount(); | |
434 void DecrementTaskCount(bool delete_data_for_origin, GURL origin); | |
435 | |
436 // Keep a reference to FileSystemContext until we are done with it. | |
437 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
438 | |
439 const base::Time begin_; | |
440 const base::Time end_; | |
441 const base::Closure callback_; | |
442 int task_count_ = 0; | |
443 }; | |
444 | |
445 void PluginPrivateDataDeletionHelper::CheckOriginsOnFileTaskRunner( | |
446 const std::set<GURL>& origins) { | |
447 DCHECK(filesystem_context_->default_file_task_runner() | |
448 ->RunsTasksOnCurrentThread()); | |
449 IncrementTaskCount(); | |
450 | |
451 base::Callback<void(bool, GURL)> decrement_callback = | |
452 base::Bind(&PluginPrivateDataDeletionHelper::DecrementTaskCount, | |
453 base::Unretained(this)); | |
454 storage::AsyncFileUtil* async_file_util = | |
455 filesystem_context_->GetAsyncFileUtil( | |
456 storage::kFileSystemTypePluginPrivate); | |
457 storage::ObfuscatedFileUtil* obfuscated_file_util = | |
458 static_cast<storage::ObfuscatedFileUtil*>( | |
459 static_cast<storage::AsyncFileUtilAdapter*>(async_file_util) | |
460 ->sync_file_util()); | |
461 for (const auto& origin : origins) { | |
462 // Determine the available plugin private filesystem directories | |
463 // for this origin. | |
464 base::File::Error error; | |
465 base::FilePath path = obfuscated_file_util->GetDirectoryForOriginAndType( | |
466 origin, "", false, &error); | |
467 if (error != base::File::FILE_OK) { | |
468 DLOG(ERROR) << "Unable to read directory for " << origin; | |
469 continue; | |
470 } | |
471 | |
472 // Currently the plugin private filesystem is only used by Encrypted | |
473 // Media Content Decryption Modules, which are treated as pepper plugins. | |
474 // Each CDM gets a directory based on the mimetype (e.g. plugin | |
475 // application/x-ppapi-widevine-cdm uses directory | |
476 // application_x-ppapi-widevine-cdm). Enumerate through the set of | |
477 // directories so that data from any CDM used by this origin is deleted. | |
478 base::FileEnumerator file_enumerator(path, false, | |
479 base::FileEnumerator::DIRECTORIES); | |
480 for (base::FilePath plugin_path = file_enumerator.Next(); | |
481 !plugin_path.empty(); plugin_path = file_enumerator.Next()) { | |
482 IncrementTaskCount(); | |
483 PluginPrivateDataByOriginDeletionHelper* helper = | |
484 new PluginPrivateDataByOriginDeletionHelper( | |
485 filesystem_context_.get(), origin.GetOrigin(), | |
486 plugin_path.BaseName().MaybeAsASCII(), begin_, end_, | |
487 decrement_callback); | |
488 BrowserThread::PostTask( | |
489 BrowserThread::FILE, FROM_HERE, | |
kinuko
2016/05/26 02:19:45
It's not obvious why we still need to use FILE thr
jrummell
2016/05/26 21:40:31
Good to know. Switched to IO thread.
| |
490 base::Bind( | |
491 &PluginPrivateDataByOriginDeletionHelper::StartOnFileThread, | |
492 base::Unretained(helper))); | |
493 | |
494 // |helper| will delete itself when it is done. | |
495 } | |
496 } | |
497 | |
498 // Cancels out the call to IncrementTaskCount() at the start of this method. | |
499 // If there are no origins specified then this will cause this helper to | |
500 // be destroyed. | |
501 DecrementTaskCount(false, GURL()); | |
502 } | |
503 | |
504 void PluginPrivateDataDeletionHelper::IncrementTaskCount() { | |
505 DCHECK(filesystem_context_->default_file_task_runner() | |
506 ->RunsTasksOnCurrentThread()); | |
507 ++task_count_; | |
508 } | |
509 | |
510 void PluginPrivateDataDeletionHelper::DecrementTaskCount( | |
511 bool delete_data_for_origin, | |
512 GURL origin) { | |
513 DCHECK(filesystem_context_->default_file_task_runner() | |
514 ->RunsTasksOnCurrentThread()); | |
515 | |
516 // Since the PluginPrivateDataByOriginDeletionHelper runs on the FILE thread, | |
517 // delete all the data for |origin| if needed. | |
518 if (delete_data_for_origin) { | |
519 DCHECK(!origin.is_empty()); | |
520 DVLOG(3) << "Deleting plugin data for " << origin; | |
521 storage::FileSystemBackend* backend = | |
522 filesystem_context_->GetFileSystemBackend( | |
523 storage::kFileSystemTypePluginPrivate); | |
524 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
525 base::File::Error result = quota_util->DeleteOriginDataOnFileTaskRunner( | |
526 filesystem_context_.get(), nullptr, origin, | |
527 storage::kFileSystemTypePluginPrivate); | |
528 DLOG_IF(ERROR, result != base::File::FILE_OK) | |
529 << "Unable to delete the plugin data for " << origin; | |
530 } | |
531 | |
532 DCHECK_GT(task_count_, 0); | |
533 --task_count_; | |
534 if (task_count_) | |
535 return; | |
536 | |
537 // If there are no more tasks in progress, run |callback_| and then | |
538 // this helper can be deleted. | |
539 callback_.Run(); | |
540 delete this; | |
541 } | |
542 | |
543 void ClearPluginPrivateDataOnFileTaskRunner( | |
544 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
545 const GURL& storage_origin, | |
546 const base::Time begin, | |
547 const base::Time end, | |
548 const base::Closure& callback) { | |
549 DCHECK(filesystem_context->default_file_task_runner() | |
550 ->RunsTasksOnCurrentThread()); | |
551 DVLOG(3) << "Clearing plugin data for origin: " << storage_origin; | |
552 | |
553 storage::FileSystemBackend* backend = | |
554 filesystem_context->GetFileSystemBackend( | |
555 storage::kFileSystemTypePluginPrivate); | |
556 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
557 | |
558 // Determine the set of origins used. | |
559 std::set<GURL> origins; | |
560 quota_util->GetOriginsForTypeOnFileTaskRunner( | |
561 storage::kFileSystemTypePluginPrivate, &origins); | |
562 | |
563 if (origins.empty()) { | |
564 // No origins, so nothing to do. | |
565 callback.Run(); | |
566 return; | |
567 } | |
568 | |
569 // If a specific origin is provided, then check that it is in the list | |
570 // returned and remove all the other origins. | |
571 if (!storage_origin.is_empty()) { | |
572 if (!ContainsKey(origins, storage_origin)) { | |
573 // Nothing matches, so nothing to do. | |
574 callback.Run(); | |
575 return; | |
576 } | |
577 | |
578 // List should only contain the one value that matches. | |
579 origins.clear(); | |
580 origins.insert(storage_origin); | |
581 } | |
582 | |
583 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( | |
584 std::move(filesystem_context), begin, end, callback); | |
585 helper->CheckOriginsOnFileTaskRunner(origins); | |
586 // |helper| will delete itself when all origins have been checked. | |
587 } | |
588 #endif // defined(ENABLE_PLUGINS) | |
589 | |
218 } // namespace | 590 } // namespace |
219 | 591 |
220 // Static. | 592 // Static. |
221 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { | 593 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { |
222 int quota_client_mask = 0; | 594 int quota_client_mask = 0; |
223 | 595 |
224 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) | 596 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) |
225 quota_client_mask |= storage::QuotaClient::kFileSystem; | 597 quota_client_mask |= storage::QuotaClient::kFileSystem; |
226 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) | 598 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) |
227 quota_client_mask |= storage::QuotaClient::kDatabase; | 599 quota_client_mask |= storage::QuotaClient::kDatabase; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 void ClearDataOnUIThread( | 681 void ClearDataOnUIThread( |
310 const GURL& storage_origin, | 682 const GURL& storage_origin, |
311 const OriginMatcherFunction& origin_matcher, | 683 const OriginMatcherFunction& origin_matcher, |
312 const CookieMatcherFunction& cookie_matcher, | 684 const CookieMatcherFunction& cookie_matcher, |
313 const base::FilePath& path, | 685 const base::FilePath& path, |
314 net::URLRequestContextGetter* rq_context, | 686 net::URLRequestContextGetter* rq_context, |
315 DOMStorageContextWrapper* dom_storage_context, | 687 DOMStorageContextWrapper* dom_storage_context, |
316 storage::QuotaManager* quota_manager, | 688 storage::QuotaManager* quota_manager, |
317 storage::SpecialStoragePolicy* special_storage_policy, | 689 storage::SpecialStoragePolicy* special_storage_policy, |
318 WebRTCIdentityStore* webrtc_identity_store, | 690 WebRTCIdentityStore* webrtc_identity_store, |
691 storage::FileSystemContext* filesystem_context, | |
319 const base::Time begin, | 692 const base::Time begin, |
320 const base::Time end); | 693 const base::Time end); |
321 | 694 |
322 void ClearQuotaManagedDataOnIOThread( | 695 void ClearQuotaManagedDataOnIOThread( |
323 const scoped_refptr<storage::QuotaManager>& quota_manager, | 696 const scoped_refptr<storage::QuotaManager>& quota_manager, |
324 const base::Time begin, | 697 const base::Time begin, |
325 const GURL& storage_origin, | 698 const GURL& storage_origin, |
326 const scoped_refptr<storage::SpecialStoragePolicy>& | 699 const scoped_refptr<storage::SpecialStoragePolicy>& |
327 special_storage_policy, | 700 special_storage_policy, |
328 const StoragePartition::OriginMatcherFunction& origin_matcher, | 701 const StoragePartition::OriginMatcherFunction& origin_matcher, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 const base::Closure& callback) { | 1001 const base::Closure& callback) { |
629 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1002 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, | 1003 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, |
631 quota_storage_remove_mask, | 1004 quota_storage_remove_mask, |
632 callback); | 1005 callback); |
633 // |helper| deletes itself when done in | 1006 // |helper| deletes itself when done in |
634 // DataDeletionHelper::DecrementTaskCountOnUI(). | 1007 // DataDeletionHelper::DecrementTaskCountOnUI(). |
635 helper->ClearDataOnUIThread( | 1008 helper->ClearDataOnUIThread( |
636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, | 1009 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
637 dom_storage_context_.get(), quota_manager_.get(), | 1010 dom_storage_context_.get(), quota_manager_.get(), |
638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); | 1011 special_storage_policy_.get(), webrtc_identity_store_.get(), |
1012 filesystem_context_.get(), begin, end); | |
639 } | 1013 } |
640 | 1014 |
641 void StoragePartitionImpl:: | 1015 void StoragePartitionImpl:: |
642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { | 1016 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { |
643 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1017 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
644 ++task_count; | 1018 ++task_count; |
645 } | 1019 } |
646 | 1020 |
647 void StoragePartitionImpl:: | 1021 void StoragePartitionImpl:: |
648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { | 1022 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( | 1142 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
769 const GURL& storage_origin, | 1143 const GURL& storage_origin, |
770 const OriginMatcherFunction& origin_matcher, | 1144 const OriginMatcherFunction& origin_matcher, |
771 const CookieMatcherFunction& cookie_matcher, | 1145 const CookieMatcherFunction& cookie_matcher, |
772 const base::FilePath& path, | 1146 const base::FilePath& path, |
773 net::URLRequestContextGetter* rq_context, | 1147 net::URLRequestContextGetter* rq_context, |
774 DOMStorageContextWrapper* dom_storage_context, | 1148 DOMStorageContextWrapper* dom_storage_context, |
775 storage::QuotaManager* quota_manager, | 1149 storage::QuotaManager* quota_manager, |
776 storage::SpecialStoragePolicy* special_storage_policy, | 1150 storage::SpecialStoragePolicy* special_storage_policy, |
777 WebRTCIdentityStore* webrtc_identity_store, | 1151 WebRTCIdentityStore* webrtc_identity_store, |
1152 storage::FileSystemContext* filesystem_context, | |
778 const base::Time begin, | 1153 const base::Time begin, |
779 const base::Time end) { | 1154 const base::Time end) { |
780 DCHECK_NE(remove_mask, 0u); | 1155 DCHECK_NE(remove_mask, 0u); |
781 DCHECK(!callback.is_null()); | 1156 DCHECK(!callback.is_null()); |
782 | 1157 |
783 IncrementTaskCountOnUI(); | 1158 IncrementTaskCountOnUI(); |
784 base::Closure decrement_callback = base::Bind( | 1159 base::Closure decrement_callback = base::Bind( |
785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); | 1160 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); |
786 | 1161 |
787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { | 1162 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 BrowserThread::PostTask( | 1223 BrowserThread::PostTask( |
849 BrowserThread::IO, | 1224 BrowserThread::IO, |
850 FROM_HERE, | 1225 FROM_HERE, |
851 base::Bind(&WebRTCIdentityStore::DeleteBetween, | 1226 base::Bind(&WebRTCIdentityStore::DeleteBetween, |
852 webrtc_identity_store, | 1227 webrtc_identity_store, |
853 begin, | 1228 begin, |
854 end, | 1229 end, |
855 decrement_callback)); | 1230 decrement_callback)); |
856 } | 1231 } |
857 | 1232 |
1233 #if defined(ENABLE_PLUGINS) | |
1234 if (remove_mask & REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA) { | |
1235 IncrementTaskCountOnUI(); | |
1236 filesystem_context->default_file_task_runner()->PostTask( | |
1237 FROM_HERE, base::Bind(&ClearPluginPrivateDataOnFileTaskRunner, | |
1238 make_scoped_refptr(filesystem_context), | |
1239 storage_origin, begin, end, decrement_callback)); | |
1240 } | |
1241 #endif // defined(ENABLE_PLUGINS) | |
1242 | |
858 DecrementTaskCountOnUI(); | 1243 DecrementTaskCountOnUI(); |
859 } | 1244 } |
860 | 1245 |
861 void StoragePartitionImpl::ClearDataForOrigin( | 1246 void StoragePartitionImpl::ClearDataForOrigin( |
862 uint32_t remove_mask, | 1247 uint32_t remove_mask, |
863 uint32_t quota_storage_remove_mask, | 1248 uint32_t quota_storage_remove_mask, |
864 const GURL& storage_origin, | 1249 const GURL& storage_origin, |
865 net::URLRequestContextGetter* request_context_getter, | 1250 net::URLRequestContextGetter* request_context_getter, |
866 const base::Closure& callback) { | 1251 const base::Closure& callback) { |
867 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1252 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 net::URLRequestContextGetter* url_request_context) { | 1314 net::URLRequestContextGetter* url_request_context) { |
930 url_request_context_ = url_request_context; | 1315 url_request_context_ = url_request_context; |
931 } | 1316 } |
932 | 1317 |
933 void StoragePartitionImpl::SetMediaURLRequestContext( | 1318 void StoragePartitionImpl::SetMediaURLRequestContext( |
934 net::URLRequestContextGetter* media_url_request_context) { | 1319 net::URLRequestContextGetter* media_url_request_context) { |
935 media_url_request_context_ = media_url_request_context; | 1320 media_url_request_context_ = media_url_request_context; |
936 } | 1321 } |
937 | 1322 |
938 } // namespace content | 1323 } // namespace content |
OLD | NEW |