| 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 "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/fileapi/browser_file_system_helper.h" | 10 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 11 #include "content/browser/gpu/shader_disk_cache.h" | 11 #include "content/browser/gpu/shader_disk_cache.h" |
| 12 #include "content/browser/host_zoom_level_context.h" |
| 13 #include "content/browser/host_zoom_map_impl.h" |
| 12 #include "content/common/dom_storage/dom_storage_types.h" | 14 #include "content/common/dom_storage/dom_storage_types.h" |
| 13 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/dom_storage_context.h" | 17 #include "content/public/browser/dom_storage_context.h" |
| 16 #include "content/public/browser/indexed_db_context.h" | 18 #include "content/public/browser/indexed_db_context.h" |
| 17 #include "content/public/browser/local_storage_usage_info.h" | 19 #include "content/public/browser/local_storage_usage_info.h" |
| 18 #include "content/public/browser/session_storage_usage_info.h" | 20 #include "content/public/browser/session_storage_usage_info.h" |
| 19 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
| 20 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 21 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 StoragePartitionImpl::StoragePartitionImpl( | 350 StoragePartitionImpl::StoragePartitionImpl( |
| 349 const base::FilePath& partition_path, | 351 const base::FilePath& partition_path, |
| 350 quota::QuotaManager* quota_manager, | 352 quota::QuotaManager* quota_manager, |
| 351 ChromeAppCacheService* appcache_service, | 353 ChromeAppCacheService* appcache_service, |
| 352 fileapi::FileSystemContext* filesystem_context, | 354 fileapi::FileSystemContext* filesystem_context, |
| 353 webkit_database::DatabaseTracker* database_tracker, | 355 webkit_database::DatabaseTracker* database_tracker, |
| 354 DOMStorageContextWrapper* dom_storage_context, | 356 DOMStorageContextWrapper* dom_storage_context, |
| 355 IndexedDBContextImpl* indexed_db_context, | 357 IndexedDBContextImpl* indexed_db_context, |
| 356 ServiceWorkerContextWrapper* service_worker_context, | 358 ServiceWorkerContextWrapper* service_worker_context, |
| 357 WebRTCIdentityStore* webrtc_identity_store, | 359 WebRTCIdentityStore* webrtc_identity_store, |
| 358 quota::SpecialStoragePolicy* special_storage_policy) | 360 quota::SpecialStoragePolicy* special_storage_policy, |
| 361 HostZoomLevelContext* host_zoom_level_context) |
| 359 : partition_path_(partition_path), | 362 : partition_path_(partition_path), |
| 360 quota_manager_(quota_manager), | 363 quota_manager_(quota_manager), |
| 361 appcache_service_(appcache_service), | 364 appcache_service_(appcache_service), |
| 362 filesystem_context_(filesystem_context), | 365 filesystem_context_(filesystem_context), |
| 363 database_tracker_(database_tracker), | 366 database_tracker_(database_tracker), |
| 364 dom_storage_context_(dom_storage_context), | 367 dom_storage_context_(dom_storage_context), |
| 365 indexed_db_context_(indexed_db_context), | 368 indexed_db_context_(indexed_db_context), |
| 366 service_worker_context_(service_worker_context), | 369 service_worker_context_(service_worker_context), |
| 367 webrtc_identity_store_(webrtc_identity_store), | 370 webrtc_identity_store_(webrtc_identity_store), |
| 368 special_storage_policy_(special_storage_policy) {} | 371 special_storage_policy_(special_storage_policy), |
| 372 host_zoom_level_context_(host_zoom_level_context) {} |
| 369 | 373 |
| 370 StoragePartitionImpl::~StoragePartitionImpl() { | 374 StoragePartitionImpl::~StoragePartitionImpl() { |
| 371 // These message loop checks are just to avoid leaks in unittests. | 375 // These message loop checks are just to avoid leaks in unittests. |
| 372 if (GetDatabaseTracker() && | 376 if (GetDatabaseTracker() && |
| 373 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 377 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 374 BrowserThread::PostTask( | 378 BrowserThread::PostTask( |
| 375 BrowserThread::FILE, FROM_HERE, | 379 BrowserThread::FILE, FROM_HERE, |
| 376 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 380 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
| 377 GetDatabaseTracker())); | 381 GetDatabaseTracker())); |
| 378 } | 382 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 453 |
| 450 scoped_refptr<ChromeAppCacheService> appcache_service = | 454 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 451 new ChromeAppCacheService(quota_manager->proxy()); | 455 new ChromeAppCacheService(quota_manager->proxy()); |
| 452 | 456 |
| 453 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 457 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
| 454 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 458 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
| 455 | 459 |
| 456 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( | 460 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( |
| 457 context->GetSpecialStoragePolicy()); | 461 context->GetSpecialStoragePolicy()); |
| 458 | 462 |
| 463 double default_zoom_level = context->GetDefaultZoomLevel(); |
| 464 scoped_refptr<HostZoomLevelContext> host_zoom_level_context = |
| 465 new HostZoomLevelContext(context->CreateZoomLevelPrefsDelegate(), |
| 466 partition_path, |
| 467 default_zoom_level); |
| 468 |
| 459 return new StoragePartitionImpl(partition_path, | 469 return new StoragePartitionImpl(partition_path, |
| 460 quota_manager.get(), | 470 quota_manager.get(), |
| 461 appcache_service.get(), | 471 appcache_service.get(), |
| 462 filesystem_context.get(), | 472 filesystem_context.get(), |
| 463 database_tracker.get(), | 473 database_tracker.get(), |
| 464 dom_storage_context.get(), | 474 dom_storage_context.get(), |
| 465 indexed_db_context.get(), | 475 indexed_db_context.get(), |
| 466 service_worker_context.get(), | 476 service_worker_context.get(), |
| 467 webrtc_identity_store.get(), | 477 webrtc_identity_store.get(), |
| 468 special_storage_policy.get()); | 478 special_storage_policy.get(), |
| 479 host_zoom_level_context.get()); |
| 469 } | 480 } |
| 470 | 481 |
| 471 base::FilePath StoragePartitionImpl::GetPath() { | 482 base::FilePath StoragePartitionImpl::GetPath() { |
| 472 return partition_path_; | 483 return partition_path_; |
| 473 } | 484 } |
| 474 | 485 |
| 475 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 486 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
| 476 return url_request_context_.get(); | 487 return url_request_context_.get(); |
| 477 } | 488 } |
| 478 | 489 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 502 } | 513 } |
| 503 | 514 |
| 504 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 515 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 505 return indexed_db_context_.get(); | 516 return indexed_db_context_.get(); |
| 506 } | 517 } |
| 507 | 518 |
| 508 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 519 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
| 509 return service_worker_context_.get(); | 520 return service_worker_context_.get(); |
| 510 } | 521 } |
| 511 | 522 |
| 523 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 524 DCHECK(host_zoom_level_context_); |
| 525 return host_zoom_level_context_->GetHostZoomMap(); |
| 526 } |
| 527 |
| 528 PrefService* StoragePartitionImpl::GetZoomLevelPrefs() { |
| 529 DCHECK(host_zoom_level_context_); |
| 530 return host_zoom_level_context_->GetZoomLevelPrefs(); |
| 531 } |
| 532 |
| 512 void StoragePartitionImpl::ClearDataImpl( | 533 void StoragePartitionImpl::ClearDataImpl( |
| 513 uint32 remove_mask, | 534 uint32 remove_mask, |
| 514 uint32 quota_storage_remove_mask, | 535 uint32 quota_storage_remove_mask, |
| 515 const GURL& storage_origin, | 536 const GURL& storage_origin, |
| 516 const OriginMatcherFunction& origin_matcher, | 537 const OriginMatcherFunction& origin_matcher, |
| 517 net::URLRequestContextGetter* rq_context, | 538 net::URLRequestContextGetter* rq_context, |
| 518 const base::Time begin, | 539 const base::Time begin, |
| 519 const base::Time end, | 540 const base::Time end, |
| 520 const base::Closure& callback) { | 541 const base::Closure& callback) { |
| 521 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 542 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 net::URLRequestContextGetter* url_request_context) { | 825 net::URLRequestContextGetter* url_request_context) { |
| 805 url_request_context_ = url_request_context; | 826 url_request_context_ = url_request_context; |
| 806 } | 827 } |
| 807 | 828 |
| 808 void StoragePartitionImpl::SetMediaURLRequestContext( | 829 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 809 net::URLRequestContextGetter* media_url_request_context) { | 830 net::URLRequestContextGetter* media_url_request_context) { |
| 810 media_url_request_context_ = media_url_request_context; | 831 media_url_request_context_ = media_url_request_context; |
| 811 } | 832 } |
| 812 | 833 |
| 813 } // namespace content | 834 } // namespace content |
| OLD | NEW |