| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 StoragePartitionImpl::StoragePartitionImpl( | 353 StoragePartitionImpl::StoragePartitionImpl( |
| 352 const base::FilePath& partition_path, | 354 const base::FilePath& partition_path, |
| 353 quota::QuotaManager* quota_manager, | 355 quota::QuotaManager* quota_manager, |
| 354 ChromeAppCacheService* appcache_service, | 356 ChromeAppCacheService* appcache_service, |
| 355 fileapi::FileSystemContext* filesystem_context, | 357 fileapi::FileSystemContext* filesystem_context, |
| 356 webkit_database::DatabaseTracker* database_tracker, | 358 webkit_database::DatabaseTracker* database_tracker, |
| 357 DOMStorageContextWrapper* dom_storage_context, | 359 DOMStorageContextWrapper* dom_storage_context, |
| 358 IndexedDBContextImpl* indexed_db_context, | 360 IndexedDBContextImpl* indexed_db_context, |
| 359 ServiceWorkerContextWrapper* service_worker_context, | 361 ServiceWorkerContextWrapper* service_worker_context, |
| 360 WebRTCIdentityStore* webrtc_identity_store, | 362 WebRTCIdentityStore* webrtc_identity_store, |
| 361 quota::SpecialStoragePolicy* special_storage_policy) | 363 quota::SpecialStoragePolicy* special_storage_policy, |
| 364 HostZoomLevelContext* host_zoom_level_context) |
| 362 : partition_path_(partition_path), | 365 : partition_path_(partition_path), |
| 363 quota_manager_(quota_manager), | 366 quota_manager_(quota_manager), |
| 364 appcache_service_(appcache_service), | 367 appcache_service_(appcache_service), |
| 365 filesystem_context_(filesystem_context), | 368 filesystem_context_(filesystem_context), |
| 366 database_tracker_(database_tracker), | 369 database_tracker_(database_tracker), |
| 367 dom_storage_context_(dom_storage_context), | 370 dom_storage_context_(dom_storage_context), |
| 368 indexed_db_context_(indexed_db_context), | 371 indexed_db_context_(indexed_db_context), |
| 369 service_worker_context_(service_worker_context), | 372 service_worker_context_(service_worker_context), |
| 370 webrtc_identity_store_(webrtc_identity_store), | 373 webrtc_identity_store_(webrtc_identity_store), |
| 371 special_storage_policy_(special_storage_policy) {} | 374 special_storage_policy_(special_storage_policy), |
| 375 host_zoom_level_context_(host_zoom_level_context) {} |
| 372 | 376 |
| 373 StoragePartitionImpl::~StoragePartitionImpl() { | 377 StoragePartitionImpl::~StoragePartitionImpl() { |
| 374 // These message loop checks are just to avoid leaks in unittests. | 378 // These message loop checks are just to avoid leaks in unittests. |
| 375 if (GetDatabaseTracker() && | 379 if (GetDatabaseTracker() && |
| 376 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 380 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 377 BrowserThread::PostTask( | 381 BrowserThread::PostTask( |
| 378 BrowserThread::FILE, FROM_HERE, | 382 BrowserThread::FILE, FROM_HERE, |
| 379 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 383 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
| 380 GetDatabaseTracker())); | 384 GetDatabaseTracker())); |
| 381 } | 385 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 456 |
| 453 scoped_refptr<ChromeAppCacheService> appcache_service = | 457 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 454 new ChromeAppCacheService(quota_manager->proxy()); | 458 new ChromeAppCacheService(quota_manager->proxy()); |
| 455 | 459 |
| 456 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 460 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
| 457 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 461 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
| 458 | 462 |
| 459 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( | 463 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( |
| 460 context->GetSpecialStoragePolicy()); | 464 context->GetSpecialStoragePolicy()); |
| 461 | 465 |
| 466 double default_zoom_level = context->GetDefaultZoomLevel(); |
| 467 scoped_refptr<HostZoomLevelContext> host_zoom_level_context = |
| 468 new HostZoomLevelContext(context->CreateZoomLevelPrefsDelegate(), |
| 469 partition_path, |
| 470 default_zoom_level); |
| 471 |
| 462 return new StoragePartitionImpl(partition_path, | 472 return new StoragePartitionImpl(partition_path, |
| 463 quota_manager.get(), | 473 quota_manager.get(), |
| 464 appcache_service.get(), | 474 appcache_service.get(), |
| 465 filesystem_context.get(), | 475 filesystem_context.get(), |
| 466 database_tracker.get(), | 476 database_tracker.get(), |
| 467 dom_storage_context.get(), | 477 dom_storage_context.get(), |
| 468 indexed_db_context.get(), | 478 indexed_db_context.get(), |
| 469 service_worker_context.get(), | 479 service_worker_context.get(), |
| 470 webrtc_identity_store.get(), | 480 webrtc_identity_store.get(), |
| 471 special_storage_policy.get()); | 481 special_storage_policy.get(), |
| 482 host_zoom_level_context.get()); |
| 472 } | 483 } |
| 473 | 484 |
| 474 base::FilePath StoragePartitionImpl::GetPath() { | 485 base::FilePath StoragePartitionImpl::GetPath() { |
| 475 return partition_path_; | 486 return partition_path_; |
| 476 } | 487 } |
| 477 | 488 |
| 478 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 489 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
| 479 return url_request_context_.get(); | 490 return url_request_context_.get(); |
| 480 } | 491 } |
| 481 | 492 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 505 } | 516 } |
| 506 | 517 |
| 507 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 518 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 508 return indexed_db_context_.get(); | 519 return indexed_db_context_.get(); |
| 509 } | 520 } |
| 510 | 521 |
| 511 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 522 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
| 512 return service_worker_context_.get(); | 523 return service_worker_context_.get(); |
| 513 } | 524 } |
| 514 | 525 |
| 526 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 527 DCHECK(host_zoom_level_context_); |
| 528 return host_zoom_level_context_->GetHostZoomMap(); |
| 529 } |
| 530 |
| 531 PrefService* StoragePartitionImpl::GetZoomLevelPrefs() { |
| 532 DCHECK(host_zoom_level_context_); |
| 533 return host_zoom_level_context_->GetZoomLevelPrefs(); |
| 534 } |
| 535 |
| 515 void StoragePartitionImpl::ClearDataImpl( | 536 void StoragePartitionImpl::ClearDataImpl( |
| 516 uint32 remove_mask, | 537 uint32 remove_mask, |
| 517 uint32 quota_storage_remove_mask, | 538 uint32 quota_storage_remove_mask, |
| 518 const GURL& storage_origin, | 539 const GURL& storage_origin, |
| 519 const OriginMatcherFunction& origin_matcher, | 540 const OriginMatcherFunction& origin_matcher, |
| 520 net::URLRequestContextGetter* rq_context, | 541 net::URLRequestContextGetter* rq_context, |
| 521 const base::Time begin, | 542 const base::Time begin, |
| 522 const base::Time end, | 543 const base::Time end, |
| 523 const base::Closure& callback) { | 544 const base::Closure& callback) { |
| 524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 net::URLRequestContextGetter* url_request_context) { | 829 net::URLRequestContextGetter* url_request_context) { |
| 809 url_request_context_ = url_request_context; | 830 url_request_context_ = url_request_context; |
| 810 } | 831 } |
| 811 | 832 |
| 812 void StoragePartitionImpl::SetMediaURLRequestContext( | 833 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 813 net::URLRequestContextGetter* media_url_request_context) { | 834 net::URLRequestContextGetter* media_url_request_context) { |
| 814 media_url_request_context_ = media_url_request_context; | 835 media_url_request_context_ = media_url_request_context; |
| 815 } | 836 } |
| 816 | 837 |
| 817 } // namespace content | 838 } // namespace content |
| OLD | NEW |