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 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/compiler_specific.h" | |
| 41 #include "base/files/file_enumerator.h" | |
| 42 #include "base/stl_util.h" | |
| 43 #include "ppapi/shared_impl/ppapi_constants.h" | |
| 44 #include "storage/browser/fileapi/async_file_util.h" | |
| 45 #include "storage/browser/fileapi/async_file_util_adapter.h" | |
| 46 #include "storage/browser/fileapi/isolated_context.h" | |
| 47 #include "storage/browser/fileapi/obfuscated_file_util.h" | |
| 48 #include "storage/common/fileapi/file_system_util.h" | |
| 49 #endif // defined(ENABLE_PLUGINS) | |
| 50 | |
| 39 namespace content { | 51 namespace content { |
| 40 | 52 |
| 41 namespace { | 53 namespace { |
| 42 | 54 |
| 43 bool DoesCookieMatchHost(const std::string& host, | 55 bool DoesCookieMatchHost(const std::string& host, |
| 44 const net::CanonicalCookie& cookie) { | 56 const net::CanonicalCookie& cookie) { |
| 45 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); | 57 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); |
| 46 } | 58 } |
| 47 | 59 |
| 48 void OnClearedCookies(const base::Closure& callback, int num_deleted) { | 60 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, | 220 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| 209 const base::Closure& callback) { | 221 const base::Closure& callback) { |
| 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 222 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 211 | 223 |
| 212 dom_storage_context->GetSessionStorageUsage( | 224 dom_storage_context->GetSessionStorageUsage( |
| 213 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, | 225 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, |
| 214 special_storage_policy, origin_matcher, | 226 special_storage_policy, origin_matcher, |
| 215 callback)); | 227 callback)); |
| 216 } | 228 } |
| 217 | 229 |
| 230 #if defined(ENABLE_PLUGINS) | |
| 231 | |
| 232 std::string StringTypeToString(const base::FilePath::StringType& value) { | |
| 233 #if defined(OS_POSIX) | |
| 234 return value; | |
| 235 #elif defined(OS_WIN) | |
| 236 return base::WideToUTF8(value); | |
| 237 #endif | |
| 238 } | |
| 239 | |
| 240 // Helper for checking the plugin private data for a specified origin and | |
| 241 // plugin for the existance of any file that matches the time range specified. | |
| 242 // All of the operations in this class are done on the IO thread. | |
| 243 class PluginPrivateDataByOriginDeletionHelper { | |
| 244 public: | |
| 245 PluginPrivateDataByOriginDeletionHelper( | |
| 246 storage::FileSystemContext* filesystem_context, | |
| 247 const GURL& origin, | |
| 248 const std::string& plugin_name, | |
| 249 const base::Time begin, | |
| 250 const base::Time end, | |
| 251 const base::Callback<void(bool, GURL)>& callback) | |
| 252 : filesystem_context_(filesystem_context), | |
| 253 origin_(origin), | |
| 254 plugin_name_(plugin_name), | |
| 255 begin_(begin), | |
| 256 end_(end), | |
| 257 callback_(callback) { | |
| 258 // Create the filesystem ID. | |
| 259 fsid_ = storage::IsolatedContext::GetInstance() | |
| 260 ->RegisterFileSystemForVirtualPath( | |
| 261 storage::kFileSystemTypePluginPrivate, | |
| 262 ppapi::kPluginPrivateRootName, base::FilePath()); | |
| 263 } | |
| 264 ~PluginPrivateDataByOriginDeletionHelper() {} | |
| 265 | |
| 266 // Checks the files contained in the plugin private filesystem for |origin_| | |
| 267 // and |plugin_name_| for any file whose last modified time is greater or | |
| 268 // equal to |begin_|. |callback_| is called when all actions are complete | |
| 269 // with true if any such file is found, false otherwise. | |
| 270 void StartOnIOThread(); | |
| 271 | |
| 272 private: | |
| 273 void OnFileSystemOpened(base::File::Error result); | |
| 274 void OnDirectoryRead(const std::string& root, | |
| 275 base::File::Error result, | |
| 276 const storage::AsyncFileUtil::EntryList& file_list, | |
| 277 bool has_more); | |
| 278 void OnFileInfo(const std::string& file_name, | |
| 279 base::File::Error result, | |
| 280 const base::File::Info& file_info); | |
| 281 | |
| 282 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
| 283 // |callback_| is called and this helper object is destroyed. | |
| 284 void IncrementTaskCount(); | |
| 285 void DecrementTaskCount(); | |
| 286 | |
| 287 // Not owned by this object. Caller is responsible for keeping the | |
| 288 // FileSystemContext alive until |callback_| is called. | |
| 289 storage::FileSystemContext* filesystem_context_; | |
| 290 | |
| 291 const GURL origin_; | |
| 292 const std::string plugin_name_; | |
| 293 const base::Time begin_; | |
| 294 const base::Time end_; | |
| 295 const base::Callback<void(bool, GURL)> callback_; | |
| 296 std::string fsid_; | |
| 297 int task_count_ = 0; | |
| 298 bool delete_this_origin_data_ = false; | |
| 299 }; | |
| 300 | |
| 301 void PluginPrivateDataByOriginDeletionHelper::StartOnIOThread() { | |
| 302 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 303 DCHECK(storage::ValidateIsolatedFileSystemId(fsid_)); | |
| 304 | |
| 305 IncrementTaskCount(); | |
| 306 filesystem_context_->OpenPluginPrivateFileSystem( | |
| 307 origin_, storage::kFileSystemTypePluginPrivate, fsid_, plugin_name_, | |
| 308 storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, | |
| 309 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened, | |
| 310 base::Unretained(this))); | |
| 311 } | |
| 312 | |
| 313 void PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened( | |
| 314 base::File::Error result) { | |
| 315 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 316 DVLOG(3) << "Opened filesystem for " << origin_ << ":" << plugin_name_ | |
| 317 << ", result: " << result; | |
| 318 | |
| 319 // If we can't open the directory, we can't delete files so simply return. | |
| 320 if (result != base::File::FILE_OK) { | |
| 321 DecrementTaskCount(); | |
| 322 return; | |
| 323 } | |
| 324 | |
| 325 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 326 storage::kFileSystemTypePluginPrivate); | |
| 327 std::string root = storage::GetIsolatedFileSystemRootURIString( | |
| 328 origin_, fsid_, ppapi::kPluginPrivateRootName); | |
| 329 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 330 base::WrapUnique( | |
| 331 new storage::FileSystemOperationContext(filesystem_context_)); | |
| 332 file_util->ReadDirectory( | |
| 333 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), | |
| 334 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead, | |
| 335 base::Unretained(this), root)); | |
| 336 } | |
| 337 | |
| 338 void PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead( | |
| 339 const std::string& root, | |
| 340 base::File::Error result, | |
| 341 const storage::AsyncFileUtil::EntryList& file_list, | |
| 342 bool has_more) { | |
| 343 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 344 DVLOG(3) << __FUNCTION__ << " result: " << result | |
| 345 << ", #files: " << file_list.size(); | |
| 346 | |
| 347 // Quit if there is an error. | |
| 348 if (result != base::File::FILE_OK) { | |
| 349 DLOG(ERROR) << "Unable to read directory for " << origin_ << ":" | |
| 350 << plugin_name_; | |
| 351 DecrementTaskCount(); | |
| 352 return; | |
| 353 } | |
| 354 | |
| 355 // No error, process the files returned. No need to do this if we have | |
| 356 // already decided to delete all the data for this origin. | |
| 357 if (!delete_this_origin_data_) { | |
| 358 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 359 storage::kFileSystemTypePluginPrivate); | |
| 360 for (const auto& file : file_list) { | |
| 361 DVLOG(3) << __FUNCTION__ << " file: " << file.name; | |
| 362 DCHECK(!file.is_directory); // Nested directories not implemented. | |
| 363 | |
| 364 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 365 base::WrapUnique( | |
| 366 new storage::FileSystemOperationContext(filesystem_context_)); | |
| 367 storage::FileSystemURL file_url = filesystem_context_->CrackURL( | |
| 368 GURL(root + StringTypeToString(file.name))); | |
| 369 IncrementTaskCount(); | |
| 370 file_util->GetFileInfo( | |
| 371 std::move(operation_context), file_url, | |
| 372 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | | |
| 373 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | |
| 374 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileInfo, | |
| 375 base::Unretained(this), StringTypeToString(file.name))); | |
| 376 } | |
| 377 } | |
| 378 | |
| 379 // If there are more files in this directory, wait for the next call. | |
| 380 if (has_more) | |
| 381 return; | |
| 382 | |
| 383 DecrementTaskCount(); | |
| 384 } | |
| 385 | |
| 386 void PluginPrivateDataByOriginDeletionHelper::OnFileInfo( | |
| 387 const std::string& file_name, | |
| 388 base::File::Error result, | |
| 389 const base::File::Info& file_info) { | |
| 390 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 391 | |
| 392 if (result == base::File::FILE_OK) { | |
| 393 DVLOG(3) << __FUNCTION__ << " name: " << file_name | |
| 394 << ", size: " << file_info.size | |
| 395 << ", modified: " << file_info.last_modified; | |
| 396 if (file_info.last_modified >= begin_ && file_info.last_modified <= end_) | |
| 397 delete_this_origin_data_ = true; | |
| 398 } | |
| 399 | |
| 400 DecrementTaskCount(); | |
| 401 } | |
| 402 | |
| 403 void PluginPrivateDataByOriginDeletionHelper::IncrementTaskCount() { | |
| 404 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 405 ++task_count_; | |
| 406 } | |
| 407 | |
| 408 void PluginPrivateDataByOriginDeletionHelper::DecrementTaskCount() { | |
| 409 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 410 DCHECK_GT(task_count_, 0); | |
| 411 --task_count_; | |
| 412 if (task_count_) | |
| 413 return; | |
| 414 | |
| 415 // If there are no more tasks in progress, then run |callback_| on the | |
| 416 // proper thread. | |
| 417 filesystem_context_->default_file_task_runner()->PostTask( | |
| 418 FROM_HERE, base::Bind(callback_, delete_this_origin_data_, origin_)); | |
| 419 delete this; | |
| 420 } | |
| 421 | |
| 422 // Helper for deleting the plugin private data. | |
| 423 // All of the operations in this class are done on the FILE thread. | |
|
nhiroki
2016/05/28 00:47:42
FILE thread -> file task runner
jrummell
2016/06/02 00:01:08
Done.
| |
| 424 class PluginPrivateDataDeletionHelper { | |
| 425 public: | |
| 426 PluginPrivateDataDeletionHelper( | |
| 427 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
| 428 const base::Time begin, | |
| 429 const base::Time end, | |
| 430 const base::Closure& callback) | |
| 431 : filesystem_context_(std::move(filesystem_context)), | |
| 432 begin_(begin), | |
| 433 end_(end), | |
| 434 callback_(callback) {} | |
| 435 ~PluginPrivateDataDeletionHelper() {} | |
| 436 | |
| 437 void CheckOriginsOnFileTaskRunner(const std::set<GURL>& origins); | |
| 438 | |
| 439 private: | |
| 440 // Keeps track of the pending work. When |task_count_| goes to 0 then | |
| 441 // |callback_| is called and this helper object is destroyed. | |
| 442 void IncrementTaskCount(); | |
| 443 void DecrementTaskCount(bool delete_data_for_origin, GURL origin); | |
|
nhiroki
2016/05/28 00:47:42
GURL -> const GURL&
jrummell
2016/06/02 00:01:08
Done.
| |
| 444 | |
| 445 // Keep a reference to FileSystemContext until we are done with it. | |
| 446 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
| 447 | |
| 448 const base::Time begin_; | |
| 449 const base::Time end_; | |
| 450 const base::Closure callback_; | |
| 451 int task_count_ = 0; | |
| 452 }; | |
| 453 | |
| 454 void PluginPrivateDataDeletionHelper::CheckOriginsOnFileTaskRunner( | |
| 455 const std::set<GURL>& origins) { | |
| 456 DCHECK(filesystem_context_->default_file_task_runner() | |
| 457 ->RunsTasksOnCurrentThread()); | |
| 458 IncrementTaskCount(); | |
| 459 | |
| 460 base::Callback<void(bool, GURL)> decrement_callback = | |
| 461 base::Bind(&PluginPrivateDataDeletionHelper::DecrementTaskCount, | |
| 462 base::Unretained(this)); | |
| 463 storage::AsyncFileUtil* async_file_util = | |
| 464 filesystem_context_->GetAsyncFileUtil( | |
| 465 storage::kFileSystemTypePluginPrivate); | |
| 466 storage::ObfuscatedFileUtil* obfuscated_file_util = | |
| 467 static_cast<storage::ObfuscatedFileUtil*>( | |
| 468 static_cast<storage::AsyncFileUtilAdapter*>(async_file_util) | |
| 469 ->sync_file_util()); | |
| 470 for (const auto& origin : origins) { | |
| 471 // Determine the available plugin private filesystem directories | |
| 472 // for this origin. | |
| 473 base::File::Error error; | |
| 474 base::FilePath path = obfuscated_file_util->GetDirectoryForOriginAndType( | |
| 475 origin, "", false, &error); | |
| 476 if (error != base::File::FILE_OK) { | |
| 477 DLOG(ERROR) << "Unable to read directory for " << origin; | |
| 478 continue; | |
| 479 } | |
| 480 | |
| 481 // Currently the plugin private filesystem is only used by Encrypted | |
| 482 // Media Content Decryption Modules, which are treated as pepper plugins. | |
| 483 // Each CDM gets a directory based on the mimetype (e.g. plugin | |
| 484 // application/x-ppapi-widevine-cdm uses directory | |
| 485 // application_x-ppapi-widevine-cdm). Enumerate through the set of | |
| 486 // directories so that data from any CDM used by this origin is deleted. | |
| 487 base::FileEnumerator file_enumerator(path, false, | |
| 488 base::FileEnumerator::DIRECTORIES); | |
| 489 for (base::FilePath plugin_path = file_enumerator.Next(); | |
| 490 !plugin_path.empty(); plugin_path = file_enumerator.Next()) { | |
| 491 IncrementTaskCount(); | |
| 492 PluginPrivateDataByOriginDeletionHelper* helper = | |
| 493 new PluginPrivateDataByOriginDeletionHelper( | |
| 494 filesystem_context_.get(), origin.GetOrigin(), | |
| 495 plugin_path.BaseName().MaybeAsASCII(), begin_, end_, | |
| 496 decrement_callback); | |
| 497 BrowserThread::PostTask( | |
| 498 BrowserThread::IO, FROM_HERE, | |
| 499 base::Bind(&PluginPrivateDataByOriginDeletionHelper::StartOnIOThread, | |
| 500 base::Unretained(helper))); | |
| 501 | |
| 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(false, GURL()); | |
| 510 } | |
| 511 | |
| 512 void PluginPrivateDataDeletionHelper::IncrementTaskCount() { | |
| 513 DCHECK(filesystem_context_->default_file_task_runner() | |
| 514 ->RunsTasksOnCurrentThread()); | |
| 515 ++task_count_; | |
| 516 } | |
| 517 | |
| 518 void PluginPrivateDataDeletionHelper::DecrementTaskCount( | |
| 519 bool delete_data_for_origin, | |
| 520 GURL origin) { | |
|
nhiroki
2016/05/28 00:47:42
GURL -> const GURL&
jrummell
2016/06/02 00:01:08
Done.
| |
| 521 DCHECK(filesystem_context_->default_file_task_runner() | |
| 522 ->RunsTasksOnCurrentThread()); | |
| 523 | |
| 524 // Since the PluginPrivateDataByOriginDeletionHelper runs on the IO thread, | |
| 525 // delete all the data for |origin| if needed. | |
| 526 if (delete_data_for_origin) { | |
| 527 DCHECK(!origin.is_empty()); | |
| 528 DVLOG(3) << "Deleting plugin data for " << origin; | |
| 529 storage::FileSystemBackend* backend = | |
| 530 filesystem_context_->GetFileSystemBackend( | |
| 531 storage::kFileSystemTypePluginPrivate); | |
| 532 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 533 base::File::Error result = quota_util->DeleteOriginDataOnFileTaskRunner( | |
| 534 filesystem_context_.get(), nullptr, origin, | |
| 535 storage::kFileSystemTypePluginPrivate); | |
| 536 ALLOW_UNUSED_LOCAL(result); | |
| 537 DLOG_IF(ERROR, result != base::File::FILE_OK) | |
| 538 << "Unable to delete the plugin data for " << origin; | |
| 539 } | |
| 540 | |
| 541 DCHECK_GT(task_count_, 0); | |
| 542 --task_count_; | |
| 543 if (task_count_) | |
| 544 return; | |
| 545 | |
| 546 // If there are no more tasks in progress, run |callback_| and then | |
| 547 // this helper can be deleted. | |
| 548 callback_.Run(); | |
| 549 delete this; | |
| 550 } | |
| 551 | |
| 552 void ClearPluginPrivateDataOnFileTaskRunner( | |
| 553 scoped_refptr<storage::FileSystemContext> filesystem_context, | |
| 554 const GURL& storage_origin, | |
| 555 const base::Time begin, | |
| 556 const base::Time end, | |
| 557 const base::Closure& callback) { | |
| 558 DCHECK(filesystem_context->default_file_task_runner() | |
| 559 ->RunsTasksOnCurrentThread()); | |
| 560 DVLOG(3) << "Clearing plugin data for origin: " << storage_origin; | |
| 561 | |
| 562 storage::FileSystemBackend* backend = | |
| 563 filesystem_context->GetFileSystemBackend( | |
| 564 storage::kFileSystemTypePluginPrivate); | |
| 565 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 566 | |
| 567 // Determine the set of origins used. | |
| 568 std::set<GURL> origins; | |
| 569 quota_util->GetOriginsForTypeOnFileTaskRunner( | |
| 570 storage::kFileSystemTypePluginPrivate, &origins); | |
| 571 | |
| 572 if (origins.empty()) { | |
| 573 // No origins, so nothing to do. | |
| 574 callback.Run(); | |
| 575 return; | |
| 576 } | |
| 577 | |
| 578 // If a specific origin is provided, then check that it is in the list | |
| 579 // returned and remove all the other origins. | |
| 580 if (!storage_origin.is_empty()) { | |
| 581 if (!ContainsKey(origins, storage_origin)) { | |
| 582 // Nothing matches, so nothing to do. | |
| 583 callback.Run(); | |
| 584 return; | |
| 585 } | |
| 586 | |
| 587 // List should only contain the one value that matches. | |
| 588 origins.clear(); | |
| 589 origins.insert(storage_origin); | |
| 590 } | |
| 591 | |
| 592 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( | |
| 593 std::move(filesystem_context), begin, end, callback); | |
| 594 helper->CheckOriginsOnFileTaskRunner(origins); | |
| 595 // |helper| will delete itself when all origins have been checked. | |
| 596 } | |
| 597 #endif // defined(ENABLE_PLUGINS) | |
| 598 | |
| 218 } // namespace | 599 } // namespace |
| 219 | 600 |
| 220 // Static. | 601 // Static. |
| 221 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { | 602 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { |
| 222 int quota_client_mask = 0; | 603 int quota_client_mask = 0; |
| 223 | 604 |
| 224 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) | 605 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) |
| 225 quota_client_mask |= storage::QuotaClient::kFileSystem; | 606 quota_client_mask |= storage::QuotaClient::kFileSystem; |
| 226 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) | 607 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) |
| 227 quota_client_mask |= storage::QuotaClient::kDatabase; | 608 quota_client_mask |= storage::QuotaClient::kDatabase; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 void ClearDataOnUIThread( | 690 void ClearDataOnUIThread( |
| 310 const GURL& storage_origin, | 691 const GURL& storage_origin, |
| 311 const OriginMatcherFunction& origin_matcher, | 692 const OriginMatcherFunction& origin_matcher, |
| 312 const CookieMatcherFunction& cookie_matcher, | 693 const CookieMatcherFunction& cookie_matcher, |
| 313 const base::FilePath& path, | 694 const base::FilePath& path, |
| 314 net::URLRequestContextGetter* rq_context, | 695 net::URLRequestContextGetter* rq_context, |
| 315 DOMStorageContextWrapper* dom_storage_context, | 696 DOMStorageContextWrapper* dom_storage_context, |
| 316 storage::QuotaManager* quota_manager, | 697 storage::QuotaManager* quota_manager, |
| 317 storage::SpecialStoragePolicy* special_storage_policy, | 698 storage::SpecialStoragePolicy* special_storage_policy, |
| 318 WebRTCIdentityStore* webrtc_identity_store, | 699 WebRTCIdentityStore* webrtc_identity_store, |
| 700 storage::FileSystemContext* filesystem_context, | |
| 319 const base::Time begin, | 701 const base::Time begin, |
| 320 const base::Time end); | 702 const base::Time end); |
| 321 | 703 |
| 322 void ClearQuotaManagedDataOnIOThread( | 704 void ClearQuotaManagedDataOnIOThread( |
| 323 const scoped_refptr<storage::QuotaManager>& quota_manager, | 705 const scoped_refptr<storage::QuotaManager>& quota_manager, |
| 324 const base::Time begin, | 706 const base::Time begin, |
| 325 const GURL& storage_origin, | 707 const GURL& storage_origin, |
| 326 const scoped_refptr<storage::SpecialStoragePolicy>& | 708 const scoped_refptr<storage::SpecialStoragePolicy>& |
| 327 special_storage_policy, | 709 special_storage_policy, |
| 328 const StoragePartition::OriginMatcherFunction& origin_matcher, | 710 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 const base::Closure& callback) { | 1010 const base::Closure& callback) { |
| 629 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1011 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, | 1012 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, |
| 631 quota_storage_remove_mask, | 1013 quota_storage_remove_mask, |
| 632 callback); | 1014 callback); |
| 633 // |helper| deletes itself when done in | 1015 // |helper| deletes itself when done in |
| 634 // DataDeletionHelper::DecrementTaskCountOnUI(). | 1016 // DataDeletionHelper::DecrementTaskCountOnUI(). |
| 635 helper->ClearDataOnUIThread( | 1017 helper->ClearDataOnUIThread( |
| 636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, | 1018 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
| 637 dom_storage_context_.get(), quota_manager_.get(), | 1019 dom_storage_context_.get(), quota_manager_.get(), |
| 638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); | 1020 special_storage_policy_.get(), webrtc_identity_store_.get(), |
| 1021 filesystem_context_.get(), begin, end); | |
| 639 } | 1022 } |
| 640 | 1023 |
| 641 void StoragePartitionImpl:: | 1024 void StoragePartitionImpl:: |
| 642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { | 1025 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { |
| 643 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1026 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 644 ++task_count; | 1027 ++task_count; |
| 645 } | 1028 } |
| 646 | 1029 |
| 647 void StoragePartitionImpl:: | 1030 void StoragePartitionImpl:: |
| 648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { | 1031 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( | 1151 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
| 769 const GURL& storage_origin, | 1152 const GURL& storage_origin, |
| 770 const OriginMatcherFunction& origin_matcher, | 1153 const OriginMatcherFunction& origin_matcher, |
| 771 const CookieMatcherFunction& cookie_matcher, | 1154 const CookieMatcherFunction& cookie_matcher, |
| 772 const base::FilePath& path, | 1155 const base::FilePath& path, |
| 773 net::URLRequestContextGetter* rq_context, | 1156 net::URLRequestContextGetter* rq_context, |
| 774 DOMStorageContextWrapper* dom_storage_context, | 1157 DOMStorageContextWrapper* dom_storage_context, |
| 775 storage::QuotaManager* quota_manager, | 1158 storage::QuotaManager* quota_manager, |
| 776 storage::SpecialStoragePolicy* special_storage_policy, | 1159 storage::SpecialStoragePolicy* special_storage_policy, |
| 777 WebRTCIdentityStore* webrtc_identity_store, | 1160 WebRTCIdentityStore* webrtc_identity_store, |
| 1161 storage::FileSystemContext* filesystem_context, | |
| 778 const base::Time begin, | 1162 const base::Time begin, |
| 779 const base::Time end) { | 1163 const base::Time end) { |
| 780 DCHECK_NE(remove_mask, 0u); | 1164 DCHECK_NE(remove_mask, 0u); |
| 781 DCHECK(!callback.is_null()); | 1165 DCHECK(!callback.is_null()); |
| 782 | 1166 |
| 783 IncrementTaskCountOnUI(); | 1167 IncrementTaskCountOnUI(); |
| 784 base::Closure decrement_callback = base::Bind( | 1168 base::Closure decrement_callback = base::Bind( |
| 785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); | 1169 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); |
| 786 | 1170 |
| 787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { | 1171 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 BrowserThread::PostTask( | 1232 BrowserThread::PostTask( |
| 849 BrowserThread::IO, | 1233 BrowserThread::IO, |
| 850 FROM_HERE, | 1234 FROM_HERE, |
| 851 base::Bind(&WebRTCIdentityStore::DeleteBetween, | 1235 base::Bind(&WebRTCIdentityStore::DeleteBetween, |
| 852 webrtc_identity_store, | 1236 webrtc_identity_store, |
| 853 begin, | 1237 begin, |
| 854 end, | 1238 end, |
| 855 decrement_callback)); | 1239 decrement_callback)); |
| 856 } | 1240 } |
| 857 | 1241 |
| 1242 #if defined(ENABLE_PLUGINS) | |
| 1243 if (remove_mask & REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA) { | |
| 1244 IncrementTaskCountOnUI(); | |
| 1245 filesystem_context->default_file_task_runner()->PostTask( | |
| 1246 FROM_HERE, base::Bind(&ClearPluginPrivateDataOnFileTaskRunner, | |
| 1247 make_scoped_refptr(filesystem_context), | |
| 1248 storage_origin, begin, end, decrement_callback)); | |
| 1249 } | |
| 1250 #endif // defined(ENABLE_PLUGINS) | |
| 1251 | |
| 858 DecrementTaskCountOnUI(); | 1252 DecrementTaskCountOnUI(); |
| 859 } | 1253 } |
| 860 | 1254 |
| 861 void StoragePartitionImpl::ClearDataForOrigin( | 1255 void StoragePartitionImpl::ClearDataForOrigin( |
| 862 uint32_t remove_mask, | 1256 uint32_t remove_mask, |
| 863 uint32_t quota_storage_remove_mask, | 1257 uint32_t quota_storage_remove_mask, |
| 864 const GURL& storage_origin, | 1258 const GURL& storage_origin, |
| 865 net::URLRequestContextGetter* request_context_getter, | 1259 net::URLRequestContextGetter* request_context_getter, |
| 866 const base::Closure& callback) { | 1260 const base::Closure& callback) { |
| 867 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1261 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 net::URLRequestContextGetter* url_request_context) { | 1323 net::URLRequestContextGetter* url_request_context) { |
| 930 url_request_context_ = url_request_context; | 1324 url_request_context_ = url_request_context; |
| 931 } | 1325 } |
| 932 | 1326 |
| 933 void StoragePartitionImpl::SetMediaURLRequestContext( | 1327 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 934 net::URLRequestContextGetter* media_url_request_context) { | 1328 net::URLRequestContextGetter* media_url_request_context) { |
| 935 media_url_request_context_ = media_url_request_context; | 1329 media_url_request_context_ = media_url_request_context; |
| 936 } | 1330 } |
| 937 | 1331 |
| 938 } // namespace content | 1332 } // namespace content |
| OLD | NEW |