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 15 matching lines...) Expand all Loading... | |
| 26 #include "content/public/browser/dom_storage_context.h" | 26 #include "content/public/browser/dom_storage_context.h" |
| 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 "ppapi/shared_impl/ppapi_constants.h" | |
| 36 #include "storage/browser/database/database_tracker.h" | 37 #include "storage/browser/database/database_tracker.h" |
| 37 #include "storage/browser/quota/quota_manager.h" | 38 #include "storage/browser/quota/quota_manager.h" |
| 38 | 39 |
| 40 #if defined(ENABLE_PLUGINS) | |
| 41 #include "base/files/file_enumerator.h" | |
| 42 #include "storage/browser/fileapi/async_file_util.h" | |
| 43 #include "storage/browser/fileapi/async_file_util_adapter.h" | |
| 44 #include "storage/browser/fileapi/isolated_context.h" | |
| 45 #include "storage/browser/fileapi/obfuscated_file_util.h" | |
| 46 #include "storage/common/fileapi/file_system_util.h" | |
| 47 #endif // defined(ENABLE_PLUGINS) | |
| 48 | |
| 39 namespace content { | 49 namespace content { |
| 40 | 50 |
| 41 namespace { | 51 namespace { |
| 42 | 52 |
| 43 bool DoesCookieMatchHost(const std::string& host, | 53 bool DoesCookieMatchHost(const std::string& host, |
| 44 const net::CanonicalCookie& cookie) { | 54 const net::CanonicalCookie& cookie) { |
| 45 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); | 55 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); |
| 46 } | 56 } |
| 47 | 57 |
| 48 void OnClearedCookies(const base::Closure& callback, int num_deleted) { | 58 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, | 218 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| 209 const base::Closure& callback) { | 219 const base::Closure& callback) { |
| 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 220 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 211 | 221 |
| 212 dom_storage_context->GetSessionStorageUsage( | 222 dom_storage_context->GetSessionStorageUsage( |
| 213 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, | 223 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, |
| 214 special_storage_policy, origin_matcher, | 224 special_storage_policy, origin_matcher, |
| 215 callback)); | 225 callback)); |
| 216 } | 226 } |
| 217 | 227 |
| 228 #if defined(ENABLE_PLUGINS) | |
| 229 // Helper for deleting plugin private data for a specified origin and plugin. | |
| 230 // If any file matches the time range specified, then all files for this | |
| 231 // origin and plugin are deleted. | |
| 232 // All of the operations in this class are done on the FILE thread. | |
| 233 class PluginPrivateDataByOriginDeletionHelper { | |
| 234 public: | |
| 235 PluginPrivateDataByOriginDeletionHelper( | |
| 236 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
|
nhiroki
2016/05/23 05:07:51
Passing "const scoped_refptr<Foo>&" is not encoura
jrummell
2016/05/23 22:25:36
Done.
| |
| 237 const GURL& origin, | |
| 238 const std::string& plugin_name, | |
| 239 const base::Time begin, | |
| 240 const base::Time end, | |
| 241 const base::Closure& callback) | |
| 242 : filesystem_context_(std::move(filesystem_context)), | |
|
nhiroki
2016/05/23 05:07:50
IIUC, std::move for const-ref object does not move
jrummell
2016/05/23 22:25:35
Converted to rawptr (and added a comment about own
| |
| 243 origin_(origin), | |
| 244 plugin_name_(plugin_name), | |
| 245 begin_(begin), | |
| 246 end_(end), | |
| 247 callback_(callback) { | |
| 248 // Create the filesystem ID. | |
| 249 fsid_ = storage::IsolatedContext::GetInstance() | |
| 250 ->RegisterFileSystemForVirtualPath( | |
| 251 storage::kFileSystemTypePluginPrivate, | |
| 252 ppapi::kPluginPrivateRootName, base::FilePath()); | |
| 253 } | |
| 254 ~PluginPrivateDataByOriginDeletionHelper() {} | |
| 255 | |
| 256 // Checks the files contained in the plugin private filesystem for |origin_| | |
| 257 // and |plugin_name_| and deletes any files whose last modified time is | |
| 258 // greater or equal to |begin_|. |callback_| is called when all actions | |
| 259 // are complete. | |
| 260 void Start(); | |
| 261 | |
| 262 private: | |
| 263 void OnFileSystemOpened(base::File::Error result); | |
| 264 void OnDirectoryRead(const std::string& root, | |
| 265 base::File::Error result, | |
| 266 const storage::AsyncFileUtil::EntryList& file_list, | |
| 267 bool has_more); | |
| 268 void OnFileInfo(const std::string& file_name, | |
| 269 const storage::FileSystemURL& file_url, | |
| 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 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
| 279 GURL origin_; | |
| 280 std::string plugin_name_; | |
| 281 base::Time begin_; | |
| 282 base::Time end_; | |
| 283 base::Closure callback_; | |
| 284 std::string fsid_; | |
| 285 int task_count_ = 0; | |
|
nhiroki
2016/05/23 05:07:50
In general, manual reference counting would be fra
jrummell
2016/05/23 22:25:36
This is the pattern used by the other helpers in t
nhiroki
2016/05/24 01:40:03
Manual reference counting would also depend on lif
| |
| 286 bool delete_this_data_ = false; | |
| 287 }; | |
| 288 | |
| 289 void PluginPrivateDataByOriginDeletionHelper::Start() { | |
| 290 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 291 DCHECK(storage::ValidateIsolatedFileSystemId(fsid_)); | |
| 292 | |
| 293 IncrementTaskCount(); | |
| 294 filesystem_context_->OpenPluginPrivateFileSystem( | |
| 295 origin_, storage::kFileSystemTypePluginPrivate, fsid_, plugin_name_, | |
| 296 storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, | |
| 297 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened, | |
| 298 base::Unretained(this))); | |
| 299 } | |
| 300 | |
| 301 void PluginPrivateDataByOriginDeletionHelper::OnFileSystemOpened( | |
| 302 base::File::Error result) { | |
| 303 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 304 DVLOG(3) << "Opened filesystem for " << origin_ << ":" << plugin_name_ | |
| 305 << ", result: " << result; | |
| 306 | |
| 307 // If we can't open the directory, we can't delete files so simply return. | |
| 308 if (result != base::File::FILE_OK) { | |
| 309 DecrementTaskCount(); | |
| 310 return; | |
| 311 } | |
| 312 | |
| 313 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 314 storage::kFileSystemTypePluginPrivate); | |
| 315 std::string root = storage::GetIsolatedFileSystemRootURIString( | |
| 316 origin_, fsid_, ppapi::kPluginPrivateRootName); | |
| 317 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 318 base::WrapUnique( | |
| 319 new storage::FileSystemOperationContext(filesystem_context_.get())); | |
| 320 file_util->ReadDirectory( | |
| 321 std::move(operation_context), filesystem_context_->CrackURL(GURL(root)), | |
| 322 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead, | |
| 323 base::Unretained(this), root)); | |
| 324 } | |
| 325 | |
| 326 void PluginPrivateDataByOriginDeletionHelper::OnDirectoryRead( | |
| 327 const std::string& root, | |
| 328 base::File::Error result, | |
| 329 const storage::AsyncFileUtil::EntryList& file_list, | |
| 330 bool has_more) { | |
| 331 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 332 DVLOG(3) << __FUNCTION__ << " result: " << result | |
| 333 << ", #files: " << file_list.size(); | |
| 334 | |
| 335 // Quit if there is an error. | |
| 336 if (result != base::File::FILE_OK) { | |
| 337 DLOG(ERROR) << "Unable to read directory for " << origin_ << ":" | |
| 338 << plugin_name_; | |
| 339 DecrementTaskCount(); | |
| 340 return; | |
| 341 } | |
| 342 | |
| 343 // No error, process the files returned. | |
| 344 storage::AsyncFileUtil* file_util = filesystem_context_->GetAsyncFileUtil( | |
| 345 storage::kFileSystemTypePluginPrivate); | |
| 346 for (const auto& file : file_list) { | |
| 347 DVLOG(3) << __FUNCTION__ << " file: " << file.name; | |
| 348 DCHECK(!file.is_directory); // Nested directories not implemented. | |
| 349 | |
| 350 std::unique_ptr<storage::FileSystemOperationContext> operation_context = | |
| 351 base::WrapUnique( | |
| 352 new storage::FileSystemOperationContext(filesystem_context_.get())); | |
| 353 storage::FileSystemURL file_url = | |
| 354 filesystem_context_->CrackURL(GURL(root + file.name)); | |
| 355 IncrementTaskCount(); | |
| 356 file_util->GetFileInfo( | |
| 357 std::move(operation_context), file_url, | |
| 358 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | | |
| 359 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, | |
| 360 base::Bind(&PluginPrivateDataByOriginDeletionHelper::OnFileInfo, | |
| 361 base::Unretained(this), file.name, file_url)); | |
| 362 } | |
| 363 | |
| 364 // If there are more files in this directory, wait for the next call. | |
| 365 if (has_more) | |
| 366 return; | |
| 367 | |
| 368 DecrementTaskCount(); | |
| 369 } | |
| 370 | |
| 371 void PluginPrivateDataByOriginDeletionHelper::OnFileInfo( | |
| 372 const std::string& file_name, | |
| 373 const storage::FileSystemURL& file_url, | |
|
nhiroki
2016/05/23 05:07:50
file_url is not used?
jrummell
2016/05/23 22:25:36
Done.
| |
| 374 base::File::Error result, | |
| 375 const base::File::Info& file_info) { | |
| 376 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 377 | |
| 378 if (result == base::File::FILE_OK) { | |
| 379 DVLOG(3) << __FUNCTION__ << " name: " << file_name | |
| 380 << ", size: " << file_info.size | |
| 381 << ", modified: " << file_info.last_modified; | |
| 382 if (file_info.last_modified >= begin_ && file_info.last_modified <= end_) | |
| 383 delete_this_data_ = true; | |
| 384 } | |
| 385 | |
| 386 DecrementTaskCount(); | |
| 387 } | |
| 388 | |
| 389 void PluginPrivateDataByOriginDeletionHelper::IncrementTaskCount() { | |
| 390 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 391 ++task_count_; | |
| 392 } | |
| 393 | |
| 394 void PluginPrivateDataByOriginDeletionHelper::DecrementTaskCount() { | |
| 395 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 396 DCHECK_GT(task_count_, 0); | |
| 397 --task_count_; | |
| 398 if (task_count_) | |
| 399 return; | |
| 400 | |
| 401 // If there are no more tasks in progress, then delete the files for this | |
| 402 // origin if necessary. | |
| 403 if (delete_this_data_) { | |
| 404 DVLOG(3) << "Deleting plugin data for " << origin_ << ":" << plugin_name_; | |
| 405 storage::FileSystemBackend* backend = | |
| 406 filesystem_context_->GetFileSystemBackend( | |
| 407 storage::kFileSystemTypePluginPrivate); | |
| 408 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 409 base::File::Error result = quota_util->DeleteOriginDataOnFileTaskRunner( | |
| 410 filesystem_context_.get(), nullptr, origin_, | |
| 411 storage::kFileSystemTypePluginPrivate); | |
| 412 DLOG_IF(ERROR, result != base::File::FILE_OK) | |
| 413 << "Unable to delete the plugin data for " << origin_ << ":" | |
| 414 << plugin_name_; | |
| 415 } | |
| 416 | |
| 417 // Run |callback_| and then this helper can be deleted. | |
| 418 callback_.Run(); | |
| 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. | |
| 424 class PluginPrivateDataDeletionHelper { | |
| 425 public: | |
| 426 PluginPrivateDataDeletionHelper( | |
| 427 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
|
nhiroki
2016/05/23 05:07:50
ditto (passing const scoped_refptr<>&).
jrummell
2016/05/23 22:25:36
Done.
| |
| 428 const base::Time begin, | |
| 429 const base::Time end, | |
| 430 const base::Closure& callback) | |
| 431 : filesystem_context_(std::move(filesystem_context)), | |
|
nhiroki
2016/05/23 05:07:51
ditto (move for const-ref object).
jrummell
2016/05/23 22:25:36
Done.
| |
| 432 begin_(begin), | |
| 433 end_(end), | |
| 434 callback_(callback) {} | |
| 435 ~PluginPrivateDataDeletionHelper() {} | |
| 436 | |
| 437 void CheckOrigins(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(); | |
| 444 | |
| 445 scoped_refptr<storage::FileSystemContext> filesystem_context_; | |
| 446 base::Time begin_; | |
| 447 base::Time end_; | |
| 448 base::Closure callback_; | |
| 449 int task_count_ = 0; | |
|
nhiroki
2016/05/23 05:07:50
ditto (manual reference counting)
jrummell
2016/05/23 22:25:35
See previous comment.
| |
| 450 }; | |
| 451 | |
| 452 void PluginPrivateDataDeletionHelper::CheckOrigins( | |
| 453 const std::set<GURL>& origins) { | |
| 454 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 455 IncrementTaskCount(); | |
| 456 | |
| 457 base::Closure decrement_callback = | |
| 458 base::Bind(&PluginPrivateDataDeletionHelper::DecrementTaskCount, | |
| 459 base::Unretained(this)); | |
| 460 for (const auto& origin : origins) { | |
| 461 // Determine the available directories for this origin. | |
| 462 storage::AsyncFileUtil* async_file_util = | |
| 463 filesystem_context_->GetAsyncFileUtil( | |
| 464 storage::kFileSystemTypePluginPrivate); | |
| 465 storage::ObfuscatedFileUtil* obfuscated_file_util = | |
|
jrummell
2016/05/20 22:17:13
This seems ugly (it's cloned from private PluginPr
| |
| 466 static_cast<storage::ObfuscatedFileUtil*>( | |
| 467 static_cast<storage::AsyncFileUtilAdapter*>(async_file_util) | |
| 468 ->sync_file_util()); | |
|
nhiroki
2016/05/23 05:07:51
You could move these lines out of the for-loop.
jrummell
2016/05/23 22:25:36
Done.
| |
| 469 base::File::Error error; | |
| 470 base::FilePath path = obfuscated_file_util->GetDirectoryForOriginAndType( | |
| 471 origin, "", false, &error); | |
| 472 if (error != base::File::FILE_OK) { | |
| 473 DLOG(ERROR) << "Unable to read directory for " << origin; | |
| 474 continue; | |
| 475 } | |
| 476 base::FileEnumerator file_enumerator(path, false, | |
| 477 base::FileEnumerator::DIRECTORIES); | |
| 478 for (base::FilePath plugin_path = file_enumerator.Next(); | |
| 479 !plugin_path.empty(); plugin_path = file_enumerator.Next()) { | |
| 480 IncrementTaskCount(); | |
| 481 PluginPrivateDataByOriginDeletionHelper* helper = | |
| 482 new PluginPrivateDataByOriginDeletionHelper( | |
| 483 filesystem_context_, origin.GetOrigin(), | |
| 484 plugin_path.BaseName().MaybeAsASCII(), begin_, end_, | |
| 485 decrement_callback); | |
| 486 helper->Start(); | |
| 487 // |helper| will delete itself when it is done. | |
| 488 } | |
| 489 } | |
| 490 | |
| 491 // Cancels out the call to IncrementTaskCount() at the start of this method. | |
| 492 // If there are no origins specified then this will cause this helper to | |
| 493 // be destroyed. | |
| 494 DecrementTaskCount(); | |
| 495 } | |
| 496 | |
| 497 void PluginPrivateDataDeletionHelper::IncrementTaskCount() { | |
| 498 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 499 ++task_count_; | |
| 500 } | |
| 501 | |
| 502 void PluginPrivateDataDeletionHelper::DecrementTaskCount() { | |
| 503 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 504 DCHECK_GT(task_count_, 0); | |
| 505 --task_count_; | |
| 506 if (task_count_) | |
| 507 return; | |
| 508 | |
| 509 // If there are no more tasks in progress, run |callback_| and then | |
| 510 // this helper can be deleted. | |
| 511 callback_.Run(); | |
| 512 delete this; | |
| 513 } | |
| 514 | |
| 515 void ClearPluginPrivateDataOnFileThread( | |
| 516 const scoped_refptr<storage::FileSystemContext>& filesystem_context, | |
|
nhiroki
2016/05/23 05:07:50
Can you remove const-ref because the caller passes
jrummell
2016/05/23 22:25:35
Done.
| |
| 517 const GURL& storage_origin, | |
| 518 const base::Time begin, | |
| 519 const base::Time end, | |
| 520 const base::Closure& callback) { | |
| 521 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 522 DVLOG(3) << "Clearing plugin data for origin: " << storage_origin; | |
| 523 | |
| 524 storage::FileSystemBackend* backend = | |
| 525 filesystem_context->GetFileSystemBackend( | |
| 526 storage::kFileSystemTypePluginPrivate); | |
| 527 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | |
| 528 | |
| 529 // Determine the set of origins used. | |
| 530 std::set<GURL> origins; | |
| 531 quota_util->GetOriginsForTypeOnFileTaskRunner( | |
| 532 storage::kFileSystemTypePluginPrivate, &origins); | |
| 533 | |
| 534 if (origins.empty()) { | |
| 535 // No origins, so nothing to do. | |
| 536 callback.Run(); | |
| 537 return; | |
| 538 } | |
| 539 | |
| 540 // If a specific origin is provided, then check that it is in the list | |
| 541 // returned and remove all the other origins. | |
| 542 if (!storage_origin.is_empty()) { | |
| 543 auto it = origins.find(storage_origin); | |
| 544 if (it == origins.end()) { | |
|
nhiroki
2016/05/23 05:07:51
Using ContainsKey in base/stl_util.h would be simp
jrummell
2016/05/23 22:25:36
Done.
| |
| 545 // Nothing matches, so nothing to do. | |
| 546 callback.Run(); | |
| 547 return; | |
| 548 } | |
| 549 | |
| 550 // List should only contain the one value that matches. | |
| 551 origins.clear(); | |
| 552 origins.insert(storage_origin); | |
| 553 } | |
| 554 | |
| 555 PluginPrivateDataDeletionHelper* helper = new PluginPrivateDataDeletionHelper( | |
| 556 std::move(filesystem_context), begin, end, callback); | |
| 557 helper->CheckOrigins(origins); | |
| 558 // |helper| will delete itself when all origins have been checked. | |
| 559 } | |
| 560 #endif // defined(ENABLE_PLUGINS) | |
| 561 | |
| 218 } // namespace | 562 } // namespace |
| 219 | 563 |
| 220 // Static. | 564 // Static. |
| 221 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { | 565 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { |
| 222 int quota_client_mask = 0; | 566 int quota_client_mask = 0; |
| 223 | 567 |
| 224 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) | 568 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) |
| 225 quota_client_mask |= storage::QuotaClient::kFileSystem; | 569 quota_client_mask |= storage::QuotaClient::kFileSystem; |
| 226 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) | 570 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) |
| 227 quota_client_mask |= storage::QuotaClient::kDatabase; | 571 quota_client_mask |= storage::QuotaClient::kDatabase; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 void ClearDataOnUIThread( | 653 void ClearDataOnUIThread( |
| 310 const GURL& storage_origin, | 654 const GURL& storage_origin, |
| 311 const OriginMatcherFunction& origin_matcher, | 655 const OriginMatcherFunction& origin_matcher, |
| 312 const CookieMatcherFunction& cookie_matcher, | 656 const CookieMatcherFunction& cookie_matcher, |
| 313 const base::FilePath& path, | 657 const base::FilePath& path, |
| 314 net::URLRequestContextGetter* rq_context, | 658 net::URLRequestContextGetter* rq_context, |
| 315 DOMStorageContextWrapper* dom_storage_context, | 659 DOMStorageContextWrapper* dom_storage_context, |
| 316 storage::QuotaManager* quota_manager, | 660 storage::QuotaManager* quota_manager, |
| 317 storage::SpecialStoragePolicy* special_storage_policy, | 661 storage::SpecialStoragePolicy* special_storage_policy, |
| 318 WebRTCIdentityStore* webrtc_identity_store, | 662 WebRTCIdentityStore* webrtc_identity_store, |
| 663 storage::FileSystemContext* filesystem_context, | |
| 319 const base::Time begin, | 664 const base::Time begin, |
| 320 const base::Time end); | 665 const base::Time end); |
| 321 | 666 |
| 322 void ClearQuotaManagedDataOnIOThread( | 667 void ClearQuotaManagedDataOnIOThread( |
| 323 const scoped_refptr<storage::QuotaManager>& quota_manager, | 668 const scoped_refptr<storage::QuotaManager>& quota_manager, |
| 324 const base::Time begin, | 669 const base::Time begin, |
| 325 const GURL& storage_origin, | 670 const GURL& storage_origin, |
| 326 const scoped_refptr<storage::SpecialStoragePolicy>& | 671 const scoped_refptr<storage::SpecialStoragePolicy>& |
| 327 special_storage_policy, | 672 special_storage_policy, |
| 328 const StoragePartition::OriginMatcherFunction& origin_matcher, | 673 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 const base::Closure& callback) { | 973 const base::Closure& callback) { |
| 629 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 974 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, | 975 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, |
| 631 quota_storage_remove_mask, | 976 quota_storage_remove_mask, |
| 632 callback); | 977 callback); |
| 633 // |helper| deletes itself when done in | 978 // |helper| deletes itself when done in |
| 634 // DataDeletionHelper::DecrementTaskCountOnUI(). | 979 // DataDeletionHelper::DecrementTaskCountOnUI(). |
| 635 helper->ClearDataOnUIThread( | 980 helper->ClearDataOnUIThread( |
| 636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, | 981 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
| 637 dom_storage_context_.get(), quota_manager_.get(), | 982 dom_storage_context_.get(), quota_manager_.get(), |
| 638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); | 983 special_storage_policy_.get(), webrtc_identity_store_.get(), |
| 984 filesystem_context_.get(), begin, end); | |
| 639 } | 985 } |
| 640 | 986 |
| 641 void StoragePartitionImpl:: | 987 void StoragePartitionImpl:: |
| 642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { | 988 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { |
| 643 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 989 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 644 ++task_count; | 990 ++task_count; |
| 645 } | 991 } |
| 646 | 992 |
| 647 void StoragePartitionImpl:: | 993 void StoragePartitionImpl:: |
| 648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { | 994 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( | 1114 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
| 769 const GURL& storage_origin, | 1115 const GURL& storage_origin, |
| 770 const OriginMatcherFunction& origin_matcher, | 1116 const OriginMatcherFunction& origin_matcher, |
| 771 const CookieMatcherFunction& cookie_matcher, | 1117 const CookieMatcherFunction& cookie_matcher, |
| 772 const base::FilePath& path, | 1118 const base::FilePath& path, |
| 773 net::URLRequestContextGetter* rq_context, | 1119 net::URLRequestContextGetter* rq_context, |
| 774 DOMStorageContextWrapper* dom_storage_context, | 1120 DOMStorageContextWrapper* dom_storage_context, |
| 775 storage::QuotaManager* quota_manager, | 1121 storage::QuotaManager* quota_manager, |
| 776 storage::SpecialStoragePolicy* special_storage_policy, | 1122 storage::SpecialStoragePolicy* special_storage_policy, |
| 777 WebRTCIdentityStore* webrtc_identity_store, | 1123 WebRTCIdentityStore* webrtc_identity_store, |
| 1124 storage::FileSystemContext* filesystem_context, | |
| 778 const base::Time begin, | 1125 const base::Time begin, |
| 779 const base::Time end) { | 1126 const base::Time end) { |
| 780 DCHECK_NE(remove_mask, 0u); | 1127 DCHECK_NE(remove_mask, 0u); |
| 781 DCHECK(!callback.is_null()); | 1128 DCHECK(!callback.is_null()); |
| 782 | 1129 |
| 783 IncrementTaskCountOnUI(); | 1130 IncrementTaskCountOnUI(); |
| 784 base::Closure decrement_callback = base::Bind( | 1131 base::Closure decrement_callback = base::Bind( |
| 785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); | 1132 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); |
| 786 | 1133 |
| 787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { | 1134 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 BrowserThread::PostTask( | 1195 BrowserThread::PostTask( |
| 849 BrowserThread::IO, | 1196 BrowserThread::IO, |
| 850 FROM_HERE, | 1197 FROM_HERE, |
| 851 base::Bind(&WebRTCIdentityStore::DeleteBetween, | 1198 base::Bind(&WebRTCIdentityStore::DeleteBetween, |
| 852 webrtc_identity_store, | 1199 webrtc_identity_store, |
| 853 begin, | 1200 begin, |
| 854 end, | 1201 end, |
| 855 decrement_callback)); | 1202 decrement_callback)); |
| 856 } | 1203 } |
| 857 | 1204 |
| 1205 #if defined(ENABLE_PLUGINS) | |
| 1206 if (remove_mask & REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA) { | |
| 1207 IncrementTaskCountOnUI(); | |
| 1208 BrowserThread::PostTask( | |
| 1209 BrowserThread::FILE, FROM_HERE, | |
| 1210 base::Bind(&ClearPluginPrivateDataOnFileThread, | |
| 1211 make_scoped_refptr(filesystem_context), storage_origin, | |
| 1212 begin, end, decrement_callback)); | |
| 1213 } | |
| 1214 #endif // defined(ENABLE_PLUGINS) | |
| 1215 | |
| 858 DecrementTaskCountOnUI(); | 1216 DecrementTaskCountOnUI(); |
| 859 } | 1217 } |
| 860 | 1218 |
| 861 void StoragePartitionImpl::ClearDataForOrigin( | 1219 void StoragePartitionImpl::ClearDataForOrigin( |
| 862 uint32_t remove_mask, | 1220 uint32_t remove_mask, |
| 863 uint32_t quota_storage_remove_mask, | 1221 uint32_t quota_storage_remove_mask, |
| 864 const GURL& storage_origin, | 1222 const GURL& storage_origin, |
| 865 net::URLRequestContextGetter* request_context_getter, | 1223 net::URLRequestContextGetter* request_context_getter, |
| 866 const base::Closure& callback) { | 1224 const base::Closure& callback) { |
| 867 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1225 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 net::URLRequestContextGetter* url_request_context) { | 1287 net::URLRequestContextGetter* url_request_context) { |
| 930 url_request_context_ = url_request_context; | 1288 url_request_context_ = url_request_context; |
| 931 } | 1289 } |
| 932 | 1290 |
| 933 void StoragePartitionImpl::SetMediaURLRequestContext( | 1291 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 934 net::URLRequestContextGetter* media_url_request_context) { | 1292 net::URLRequestContextGetter* media_url_request_context) { |
| 935 media_url_request_context_ = media_url_request_context; | 1293 media_url_request_context_ = media_url_request_context; |
| 936 } | 1294 } |
| 937 | 1295 |
| 938 } // namespace content | 1296 } // namespace content |
| OLD | NEW |