Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 #include "content/public/browser/indexed_db_context.h" | 27 #include "content/public/browser/indexed_db_context.h" |
| 28 #include "content/public/browser/local_storage_usage_info.h" | 28 #include "content/public/browser/local_storage_usage_info.h" |
| 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/fileapi/async_file_util.h" | |
| 38 #include "storage/browser/fileapi/isolated_context.h" | |
| 37 #include "storage/browser/quota/quota_manager.h" | 39 #include "storage/browser/quota/quota_manager.h" |
| 40 #include "storage/common/fileapi/file_system_util.h" | |
| 38 | 41 |
| 39 namespace content { | 42 namespace content { |
| 40 | 43 |
| 41 namespace { | 44 namespace { |
| 42 | 45 |
| 46 const char kPluginPrivateRootName[] = "pluginprivate"; | |
|
xhwang
2016/05/16 17:35:23
Is this documented anywhere? Where is this magic s
jrummell
2016/05/19 00:45:57
It comes from the pepper code, that converts the p
| |
| 47 const char kWidevineCdmPluginId[] = "application_x-ppapi-widevine-cdm"; | |
| 48 const char kClearKeyCdmPluginId[] = "application_x-ppapi-clearkey-cdm"; | |
|
xhwang
2016/05/16 17:35:23
In other places the pepper type is application/x-p
jrummell
2016/05/19 00:45:56
The conversion is done in GeneratePluginId [1] whi
| |
| 49 | |
| 43 bool DoesCookieMatchHost(const std::string& host, | 50 bool DoesCookieMatchHost(const std::string& host, |
| 44 const net::CanonicalCookie& cookie) { | 51 const net::CanonicalCookie& cookie) { |
| 45 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); | 52 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); |
| 46 } | 53 } |
| 47 | 54 |
| 48 void OnClearedCookies(const base::Closure& callback, int num_deleted) { | 55 void OnClearedCookies(const base::Closure& callback, int num_deleted) { |
| 49 // The final callback needs to happen from UI thread. | 56 // The final callback needs to happen from UI thread. |
| 50 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 57 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 51 BrowserThread::PostTask( | 58 BrowserThread::PostTask( |
| 52 BrowserThread::UI, FROM_HERE, | 59 BrowserThread::UI, FROM_HERE, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 const StoragePartition::OriginMatcherFunction& origin_matcher, | 215 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| 209 const base::Closure& callback) { | 216 const base::Closure& callback) { |
| 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 217 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 211 | 218 |
| 212 dom_storage_context->GetSessionStorageUsage( | 219 dom_storage_context->GetSessionStorageUsage( |
| 213 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, | 220 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, |
| 214 special_storage_policy, origin_matcher, | 221 special_storage_policy, origin_matcher, |
| 215 callback)); | 222 callback)); |
| 216 } | 223 } |
| 217 | 224 |
| 225 // Helper for deleting content licenses for a specified origin and plugin. | |
| 226 // If any file matches the time range specified, then all files for this | |
| 227 // origin and plugin are deleted. | |
| 228 // All of the operations in this class are done on the FILE thread. | |
| 229 class PluginPrivateContentLicensesDeletionHelper { | |
|
xhwang
2016/05/16 17:35:23
About naming: The UI is TBD and is subject to chan
jrummell
2016/05/19 00:45:56
Done.
| |
| 230 public: | |
| 231 PluginPrivateContentLicensesDeletionHelper( | |
| 232 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
| 233 const GURL& origin, | |
| 234 const std::string& plugin_name, | |
| 235 const base::Time begin, | |
| 236 const base::Time end, | |
| 237 const base::Closure& callback) | |
| 238 : filesystem_context_(std::move(filesystem_context)), | |
| 239 origin_(origin), | |
| 240 plugin_name_(plugin_name), | |
| 241 begin_(begin), | |
| 242 end_(end), | |
| 243 callback_(callback) { | |
| 244 // Create the filesystem ID. | |
| 245 fsid_ = storage::IsolatedContext::GetInstance() | |
| 246 ->RegisterFileSystemForVirtualPath( | |
| 247 storage::kFileSystemTypePluginPrivate, | |
| 248 kPluginPrivateRootName, base::FilePath()); | |
| 249 } | |
| 250 ~PluginPrivateContentLicensesDeletionHelper() {} | |
| 251 | |
| 252 // Checks the files contained in the plugin private filesystem for |origin_| | |
| 253 // and |plugin_name_| and deletes any files whose last modified time is | |
| 254 // greater or equal to |begin_|. |callback_| is called when all actions | |
| 255 // are complete. | |
| 256 void Start(); | |
| 257 | |
| 258 private: | |
| 259 void OnFileSystemOpened(base::File::Error result); | |
| 260 void OnDirectoryRead(const std::string& root, | |
| 261 base::File::Error result, | |
| 262 const storage::AsyncFileUtil::EntryList& file_list, | |
| 263 bool has_more); | |
| 264 void OnFileInfo(const std::string& file_name, | |
| 265 const storage::FileSystemURL& file_url, | |
| 266 base::File::Error result, | |
| 267 const base::File::Info& file_info); | |
| 268 | |
| 269 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
| 270 // |callback_| is called and this helper object is destroyed. | |
| 271 void IncrementTaskCount(); | |
| 272 void DecrementTaskCount(); | |
| 273 | |
| 274 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
| 275 GURL origin_; | |
| 276 std::string plugin_name_; | |
| 277 base::Time begin_; | |
| 278 base::Time end_; | |
| 279 base::Closure callback_; | |
| 280 std::string fsid_; | |
| 281 int task_count_ = 0; | |
| 282 bool delete_this_data_ = false; | |
| 283 }; | |
| 284 | |
| 285 void PluginPrivateContentLicensesDeletionHelper::Start() { | |
| 286 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 287 DCHECK(storage::ValidateIsolatedFileSystemId(fsid_)); | |
| 288 | |
| 289 IncrementTaskCount(); | |
| 290 filesystem_context_->OpenPluginPrivateFileSystem( | |
| 291 origin_, storage::kFileSystemTypePluginPrivate, fsid_, plugin_name_, | |
| 292 storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, | |
| 293 base::Bind( | |
| 294 &PluginPrivateContentLicensesDeletionHelper::OnFileSystemOpened, | |
| 295 base::Unretained(this))); | |
| 296 } | |
| 297 | |
| 298 void PluginPrivateContentLicensesDeletionHelper::OnFileSystemOpened( | |
| 299 base::File::Error result) { | |
| 300 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 301 DVLOG(3) << "Opened filesystem for " << origin_ << ":" << plugin_name_ | |
| 302 << ", result: " << result; | |
| 303 | |
| 304 // If we can't open the directory, we can't delete files so simply return. | |
| 305 if (result != base::File::FILE_OK) { | |
| 306 DecrementTaskCount(); | |
| 307 return; | |
| 308 } | |
| 309 | |
| 310 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 311 storage::kFileSystemTypePluginPrivate); | |
| 312 std::string root = storage::GetIsolatedFileSystemRootURIString( | |
| 313 origin_, fsid_, kPluginPrivateRootName); | |
| 314 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 315 base::WrapUnique( | |
| 316 new storage::FileSystemOperationContext(filesystem_context_.get())); | |
| 317 file_util->ReadDirectory( | |
| 318 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), | |
| 319 base::Bind(&PluginPrivateContentLicensesDeletionHelper::OnDirectoryRead, | |
| 320 base::Unretained(this), root)); | |
| 321 } | |
| 322 | |
| 323 void PluginPrivateContentLicensesDeletionHelper::OnDirectoryRead( | |
| 324 const std::string& root, | |
| 325 base::File::Error result, | |
| 326 const storage::AsyncFileUtil::EntryList& file_list, | |
| 327 bool has_more) { | |
| 328 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 329 DVLOG(3) << __FUNCTION__ << " result: " << result | |
| 330 << ", #files: " << file_list.size(); | |
| 331 | |
| 332 // Quit if there is an error. | |
| 333 if (result != base::File::FILE_OK) { | |
| 334 DLOG(ERROR) << "Unable to read directory for " << origin_ << ":" | |
| 335 << plugin_name_; | |
| 336 DecrementTaskCount(); | |
| 337 return; | |
| 338 } | |
| 339 | |
| 340 // No error, process the files returned. | |
| 341 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 342 storage::kFileSystemTypePluginPrivate); | |
| 343 for (const auto& file : file_list) { | |
| 344 DVLOG(3) << __FUNCTION__ << " file: " << file.name; | |
| 345 DCHECK(!file.is_directory); // Nested directories not implemented. | |
| 346 | |
| 347 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 348 base::WrapUnique( | |
| 349 new storage::FileSystemOperationContext(filesystem_context_.get())); | |
| 350 storage::FileSystemURL file_url = | |
| 351 filesystem_context_->CrackURL(GURL(root + file.name)); | |
| 352 IncrementTaskCount(); | |
| 353 file_util->GetFileInfo( | |
| 354 std::move(operation_context), file_url, | |
| 355 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | | |
| 356 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | |
| 357 base::Bind(&PluginPrivateContentLicensesDeletionHelper::OnFileInfo, | |
| 358 base::Unretained(this), file.name, file_url)); | |
| 359 } | |
| 360 | |
| 361 // If there are more files in this directory, wait for the next call. | |
| 362 if (has_more) | |
| 363 return; | |
| 364 | |
| 365 DecrementTaskCount(); | |
| 366 } | |
| 367 | |
| 368 void PluginPrivateContentLicensesDeletionHelper::OnFileInfo( | |
| 369 const std::string& file_name, | |
| 370 const storage::FileSystemURL& file_url, | |
| 371 base::File::Error result, | |
| 372 const base::File::Info& file_info) { | |
| 373 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 374 | |
| 375 if (result == base::File::FILE_OK) { | |
| 376 DVLOG(3) << __FUNCTION__ << " name: " << file_name | |
| 377 << ", size: " << file_info.size | |
| 378 << ", modified: " << file_info.last_modified; | |
| 379 if (file_info.last_modified >= begin_ && file_info.last_modified <= end_) | |
| 380 delete_this_data_ = true; | |
| 381 } | |
| 382 | |
| 383 DecrementTaskCount(); | |
| 384 } | |
| 385 | |
| 386 void PluginPrivateContentLicensesDeletionHelper::IncrementTaskCount() { | |
| 387 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 388 ++task_count_; | |
| 389 } | |
| 390 | |
| 391 void PluginPrivateContentLicensesDeletionHelper::DecrementTaskCount() { | |
| 392 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 393 DCHECK_GT(task_count_, 0); | |
| 394 --task_count_; | |
| 395 if (task_count_) | |
| 396 return; | |
| 397 | |
| 398 // If there are no more tasks in progress, then delete the files for this | |
| 399 // origin if necessary. | |
| 400 if (delete_this_data_) { | |
| 401 DVLOG(3) << "Deleting content licenses for " << origin_ << ":" | |
| 402 << plugin_name_; | |
| 403 storage::FileSystemBackend* backend = | |
| 404 filesystem_context_->GetFileSystemBackend( | |
| 405 storage::kFileSystemTypePluginPrivate); | |
| 406 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 407 base::File::Error result = quota_util->DeleteOriginDataOnFileTaskRunner( | |
| 408 filesystem_context_.get(), nullptr, origin_, | |
| 409 storage::kFileSystemTypePluginPrivate); | |
| 410 DLOG_IF(ERROR, result != base::File::FILE_OK) | |
| 411 << "Unable to delete the content licenses for " << origin_ << ":" | |
| 412 << plugin_name_; | |
| 413 } | |
| 414 | |
| 415 // Run |callback_| and then this helper can be deleted. | |
| 416 callback_.Run(); | |
| 417 delete this; | |
| 418 } | |
| 419 | |
| 420 // Helper for deleting content licenses. | |
| 421 // All of the operations in this class are done on the FILE thread. | |
| 422 class ContentLicensesDeletionHelper { | |
| 423 public: | |
| 424 ContentLicensesDeletionHelper( | |
| 425 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
| 426 const base::Time begin, | |
| 427 const base::Time end, | |
| 428 const base::Closure& callback) | |
| 429 : filesystem_context_(std::move(filesystem_context)), | |
| 430 begin_(begin), | |
| 431 end_(end), | |
| 432 callback_(callback) {} | |
| 433 ~ContentLicensesDeletionHelper() {} | |
| 434 | |
| 435 void CheckOrigins(const std::set<GURL>& origins); | |
| 436 | |
| 437 private: | |
| 438 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
| 439 // |callback_| is called and this helper object is destroyed. | |
| 440 void IncrementTaskCount(); | |
| 441 void DecrementTaskCount(); | |
| 442 | |
| 443 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
| 444 base::Time begin_; | |
| 445 base::Time end_; | |
| 446 base::Closure callback_; | |
| 447 int task_count_ = 0; | |
| 448 }; | |
| 449 | |
| 450 void ContentLicensesDeletionHelper::CheckOrigins( | |
| 451 const std::set<GURL>& origins) { | |
| 452 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 453 IncrementTaskCount(); | |
| 454 | |
| 455 std::vector<std::string> supported_plugins = { | |
| 456 kWidevineCdmPluginId, kClearKeyCdmPluginId, | |
| 457 }; | |
| 458 // TODO(jrummell): Is there any way to determine the set of plugin IDs | |
| 459 // directly from the filesystem? | |
|
xhwang
2016/05/16 17:35:23
We should ask storage owners about this.
jrummell
2016/05/19 00:45:57
Done.
| |
| 460 base::Closure decrement_callback = | |
| 461 base::Bind(&ContentLicensesDeletionHelper::DecrementTaskCount, | |
| 462 base::Unretained(this)); | |
| 463 for (const auto& origin : origins) { | |
| 464 for (const auto& plugin : supported_plugins) { | |
| 465 IncrementTaskCount(); | |
| 466 PluginPrivateContentLicensesDeletionHelper* helper = | |
| 467 new PluginPrivateContentLicensesDeletionHelper( | |
| 468 filesystem_context_, origin.GetOrigin(), plugin, begin_, end_, | |
| 469 decrement_callback); | |
| 470 helper->Start(); | |
| 471 } | |
| 472 } | |
| 473 | |
| 474 // Cancels out the call to IncrementTaskCount() at the start of this method. | |
| 475 // If there are no origins specified then this will cause this helper to | |
| 476 // be destroyed. | |
| 477 DecrementTaskCount(); | |
| 478 } | |
| 479 | |
| 480 void ContentLicensesDeletionHelper::IncrementTaskCount() { | |
| 481 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 482 ++task_count_; | |
| 483 } | |
| 484 | |
| 485 void ContentLicensesDeletionHelper::DecrementTaskCount() { | |
| 486 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 487 DCHECK_GT(task_count_, 0); | |
| 488 --task_count_; | |
| 489 if (task_count_) | |
| 490 return; | |
| 491 | |
| 492 // If there are no more tasks in progress, run |callback_| and then | |
| 493 // this helper can be deleted. | |
| 494 callback_.Run(); | |
| 495 delete this; | |
| 496 } | |
| 497 | |
| 498 void ClearContentLicensesOnFileThread( | |
|
xhwang
2016/05/16 17:35:23
Can we document about thread safety? For example,
| |
| 499 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
| 500 const GURL& storage_origin, | |
| 501 const base::Time begin, | |
| 502 const base::Time end, | |
| 503 const base::Closure& callback) { | |
| 504 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 505 DVLOG(3) << "Clearing content licenses for origin: " << storage_origin; | |
| 506 | |
| 507 storage::FileSystemBackend* backend = | |
| 508 filesystem_context->GetFileSystemBackend( | |
| 509 storage::kFileSystemTypePluginPrivate); | |
| 510 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 511 | |
| 512 // Determine the set of origins used. | |
| 513 std::set<GURL> origins; | |
| 514 quota_util->GetOriginsForTypeOnFileTaskRunner( | |
| 515 storage::kFileSystemTypePluginPrivate, &origins); | |
| 516 | |
| 517 if (origins.empty()) { | |
| 518 // No origins, so nothing to do. | |
| 519 callback.Run(); | |
| 520 return; | |
| 521 } | |
| 522 | |
| 523 // If a specific origin is provided, then check that it is in the list | |
| 524 // returned and remove all the other origins. | |
| 525 if (!storage_origin.is_empty()) { | |
| 526 auto it = origins.find(storage_origin); | |
| 527 if (it == origins.end()) { | |
| 528 // Nothing matches, so nothing to do. | |
| 529 callback.Run(); | |
| 530 return; | |
| 531 } | |
| 532 | |
| 533 // List should only contain the one value that matches. | |
| 534 origins.clear(); | |
| 535 origins.insert(storage_origin); | |
| 536 } | |
| 537 | |
| 538 ContentLicensesDeletionHelper* helper = new ContentLicensesDeletionHelper( | |
| 539 std::move(filesystem_context), begin, end, callback); | |
| 540 helper->CheckOrigins(origins); | |
| 541 // |helper| will delete itself when all origins have been checked. | |
| 542 } | |
| 543 | |
| 218 } // namespace | 544 } // namespace |
| 219 | 545 |
| 220 // Static. | 546 // Static. |
| 221 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { | 547 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { |
| 222 int quota_client_mask = 0; | 548 int quota_client_mask = 0; |
| 223 | 549 |
| 224 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) | 550 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) |
| 225 quota_client_mask |= storage::QuotaClient::kFileSystem; | 551 quota_client_mask |= storage::QuotaClient::kFileSystem; |
| 226 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) | 552 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) |
| 227 quota_client_mask |= storage::QuotaClient::kDatabase; | 553 quota_client_mask |= storage::QuotaClient::kDatabase; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 void ClearDataOnUIThread( | 635 void ClearDataOnUIThread( |
| 310 const GURL& storage_origin, | 636 const GURL& storage_origin, |
| 311 const OriginMatcherFunction& origin_matcher, | 637 const OriginMatcherFunction& origin_matcher, |
| 312 const CookieMatcherFunction& cookie_matcher, | 638 const CookieMatcherFunction& cookie_matcher, |
| 313 const base::FilePath& path, | 639 const base::FilePath& path, |
| 314 net::URLRequestContextGetter* rq_context, | 640 net::URLRequestContextGetter* rq_context, |
| 315 DOMStorageContextWrapper* dom_storage_context, | 641 DOMStorageContextWrapper* dom_storage_context, |
| 316 storage::QuotaManager* quota_manager, | 642 storage::QuotaManager* quota_manager, |
| 317 storage::SpecialStoragePolicy* special_storage_policy, | 643 storage::SpecialStoragePolicy* special_storage_policy, |
| 318 WebRTCIdentityStore* webrtc_identity_store, | 644 WebRTCIdentityStore* webrtc_identity_store, |
| 645 storage::FileSystemContext* filesystem_context, | |
| 319 const base::Time begin, | 646 const base::Time begin, |
| 320 const base::Time end); | 647 const base::Time end); |
| 321 | 648 |
| 322 void ClearQuotaManagedDataOnIOThread( | 649 void ClearQuotaManagedDataOnIOThread( |
| 323 const scoped_refptr<storage::QuotaManager>& quota_manager, | 650 const scoped_refptr<storage::QuotaManager>& quota_manager, |
| 324 const base::Time begin, | 651 const base::Time begin, |
| 325 const GURL& storage_origin, | 652 const GURL& storage_origin, |
| 326 const scoped_refptr<storage::SpecialStoragePolicy>& | 653 const scoped_refptr<storage::SpecialStoragePolicy>& |
| 327 special_storage_policy, | 654 special_storage_policy, |
| 328 const StoragePartition::OriginMatcherFunction& origin_matcher, | 655 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 const base::Closure& callback) { | 955 const base::Closure& callback) { |
| 629 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 956 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, | 957 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, |
| 631 quota_storage_remove_mask, | 958 quota_storage_remove_mask, |
| 632 callback); | 959 callback); |
| 633 // |helper| deletes itself when done in | 960 // |helper| deletes itself when done in |
| 634 // DataDeletionHelper::DecrementTaskCountOnUI(). | 961 // DataDeletionHelper::DecrementTaskCountOnUI(). |
| 635 helper->ClearDataOnUIThread( | 962 helper->ClearDataOnUIThread( |
| 636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, | 963 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
| 637 dom_storage_context_.get(), quota_manager_.get(), | 964 dom_storage_context_.get(), quota_manager_.get(), |
| 638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); | 965 special_storage_policy_.get(), webrtc_identity_store_.get(), |
| 966 filesystem_context_.get(), begin, end); | |
| 639 } | 967 } |
| 640 | 968 |
| 641 void StoragePartitionImpl:: | 969 void StoragePartitionImpl:: |
| 642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { | 970 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { |
| 643 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 971 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 644 ++task_count; | 972 ++task_count; |
| 645 } | 973 } |
| 646 | 974 |
| 647 void StoragePartitionImpl:: | 975 void StoragePartitionImpl:: |
| 648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { | 976 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( | 1096 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
| 769 const GURL& storage_origin, | 1097 const GURL& storage_origin, |
| 770 const OriginMatcherFunction& origin_matcher, | 1098 const OriginMatcherFunction& origin_matcher, |
| 771 const CookieMatcherFunction& cookie_matcher, | 1099 const CookieMatcherFunction& cookie_matcher, |
| 772 const base::FilePath& path, | 1100 const base::FilePath& path, |
| 773 net::URLRequestContextGetter* rq_context, | 1101 net::URLRequestContextGetter* rq_context, |
| 774 DOMStorageContextWrapper* dom_storage_context, | 1102 DOMStorageContextWrapper* dom_storage_context, |
| 775 storage::QuotaManager* quota_manager, | 1103 storage::QuotaManager* quota_manager, |
| 776 storage::SpecialStoragePolicy* special_storage_policy, | 1104 storage::SpecialStoragePolicy* special_storage_policy, |
| 777 WebRTCIdentityStore* webrtc_identity_store, | 1105 WebRTCIdentityStore* webrtc_identity_store, |
| 1106 storage::FileSystemContext* filesystem_context, | |
| 778 const base::Time begin, | 1107 const base::Time begin, |
| 779 const base::Time end) { | 1108 const base::Time end) { |
| 780 DCHECK_NE(remove_mask, 0u); | 1109 DCHECK_NE(remove_mask, 0u); |
| 781 DCHECK(!callback.is_null()); | 1110 DCHECK(!callback.is_null()); |
| 782 | 1111 |
| 783 IncrementTaskCountOnUI(); | 1112 IncrementTaskCountOnUI(); |
| 784 base::Closure decrement_callback = base::Bind( | 1113 base::Closure decrement_callback = base::Bind( |
| 785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); | 1114 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); |
| 786 | 1115 |
| 787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { | 1116 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 BrowserThread::PostTask( | 1177 BrowserThread::PostTask( |
| 849 BrowserThread::IO, | 1178 BrowserThread::IO, |
| 850 FROM_HERE, | 1179 FROM_HERE, |
| 851 base::Bind(&WebRTCIdentityStore::DeleteBetween, | 1180 base::Bind(&WebRTCIdentityStore::DeleteBetween, |
| 852 webrtc_identity_store, | 1181 webrtc_identity_store, |
| 853 begin, | 1182 begin, |
| 854 end, | 1183 end, |
| 855 decrement_callback)); | 1184 decrement_callback)); |
| 856 } | 1185 } |
| 857 | 1186 |
| 1187 if (remove_mask & REMOVE_DATA_MASK_CONTENT_LICENSES) { | |
| 1188 IncrementTaskCountOnUI(); | |
| 1189 BrowserThread::PostTask( | |
| 1190 BrowserThread::FILE, FROM_HERE, | |
| 1191 base::Bind(&ClearContentLicensesOnFileThread, | |
| 1192 make_scoped_refptr(filesystem_context), storage_origin, | |
| 1193 begin, end, decrement_callback)); | |
| 1194 } | |
| 1195 | |
| 858 DecrementTaskCountOnUI(); | 1196 DecrementTaskCountOnUI(); |
| 859 } | 1197 } |
| 860 | 1198 |
| 861 void StoragePartitionImpl::ClearDataForOrigin( | 1199 void StoragePartitionImpl::ClearDataForOrigin( |
| 862 uint32_t remove_mask, | 1200 uint32_t remove_mask, |
| 863 uint32_t quota_storage_remove_mask, | 1201 uint32_t quota_storage_remove_mask, |
| 864 const GURL& storage_origin, | 1202 const GURL& storage_origin, |
| 865 net::URLRequestContextGetter* request_context_getter, | 1203 net::URLRequestContextGetter* request_context_getter, |
| 866 const base::Closure& callback) { | 1204 const base::Closure& callback) { |
| 867 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1205 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 net::URLRequestContextGetter* url_request_context) { | 1267 net::URLRequestContextGetter* url_request_context) { |
| 930 url_request_context_ = url_request_context; | 1268 url_request_context_ = url_request_context; |
| 931 } | 1269 } |
| 932 | 1270 |
| 933 void StoragePartitionImpl::SetMediaURLRequestContext( | 1271 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 934 net::URLRequestContextGetter* media_url_request_context) { | 1272 net::URLRequestContextGetter* media_url_request_context) { |
| 935 media_url_request_context_ = media_url_request_context; | 1273 media_url_request_context_ = media_url_request_context; |
| 936 } | 1274 } |
| 937 | 1275 |
| 938 } // namespace content | 1276 } // namespace content |
| OLD | NEW |