| 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/geofencing/geofencing_manager.h" | 11 #include "content/browser/geofencing/geofencing_manager.h" |
| 12 #include "content/browser/gpu/shader_disk_cache.h" | 12 #include "content/browser/gpu/shader_disk_cache.h" |
| 13 #include "content/browser/host_zoom_map_impl.h" | 13 #include "content/browser/host_zoom_map_impl.h" |
| 14 #include "content/browser/navigator_connect/navigator_connect_context.h" |
| 14 #include "content/common/dom_storage/dom_storage_types.h" | 15 #include "content/common/dom_storage/dom_storage_types.h" |
| 15 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/dom_storage_context.h" | 18 #include "content/public/browser/dom_storage_context.h" |
| 18 #include "content/public/browser/indexed_db_context.h" | 19 #include "content/public/browser/indexed_db_context.h" |
| 19 #include "content/public/browser/local_storage_usage_info.h" | 20 #include "content/public/browser/local_storage_usage_info.h" |
| 20 #include "content/public/browser/session_storage_usage_info.h" | 21 #include "content/public/browser/session_storage_usage_info.h" |
| 21 #include "net/base/completion_callback.h" | 22 #include "net/base/completion_callback.h" |
| 22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 23 #include "net/cookies/cookie_monster.h" | 24 #include "net/cookies/cookie_monster.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 storage::QuotaManager* quota_manager, | 364 storage::QuotaManager* quota_manager, |
| 364 ChromeAppCacheService* appcache_service, | 365 ChromeAppCacheService* appcache_service, |
| 365 storage::FileSystemContext* filesystem_context, | 366 storage::FileSystemContext* filesystem_context, |
| 366 storage::DatabaseTracker* database_tracker, | 367 storage::DatabaseTracker* database_tracker, |
| 367 DOMStorageContextWrapper* dom_storage_context, | 368 DOMStorageContextWrapper* dom_storage_context, |
| 368 IndexedDBContextImpl* indexed_db_context, | 369 IndexedDBContextImpl* indexed_db_context, |
| 369 ServiceWorkerContextWrapper* service_worker_context, | 370 ServiceWorkerContextWrapper* service_worker_context, |
| 370 WebRTCIdentityStore* webrtc_identity_store, | 371 WebRTCIdentityStore* webrtc_identity_store, |
| 371 storage::SpecialStoragePolicy* special_storage_policy, | 372 storage::SpecialStoragePolicy* special_storage_policy, |
| 372 GeofencingManager* geofencing_manager, | 373 GeofencingManager* geofencing_manager, |
| 373 HostZoomLevelContext* host_zoom_level_context) | 374 HostZoomLevelContext* host_zoom_level_context, |
| 375 NavigatorConnectContext* navigator_connect_context) |
| 374 : partition_path_(partition_path), | 376 : partition_path_(partition_path), |
| 375 quota_manager_(quota_manager), | 377 quota_manager_(quota_manager), |
| 376 appcache_service_(appcache_service), | 378 appcache_service_(appcache_service), |
| 377 filesystem_context_(filesystem_context), | 379 filesystem_context_(filesystem_context), |
| 378 database_tracker_(database_tracker), | 380 database_tracker_(database_tracker), |
| 379 dom_storage_context_(dom_storage_context), | 381 dom_storage_context_(dom_storage_context), |
| 380 indexed_db_context_(indexed_db_context), | 382 indexed_db_context_(indexed_db_context), |
| 381 service_worker_context_(service_worker_context), | 383 service_worker_context_(service_worker_context), |
| 382 webrtc_identity_store_(webrtc_identity_store), | 384 webrtc_identity_store_(webrtc_identity_store), |
| 383 special_storage_policy_(special_storage_policy), | 385 special_storage_policy_(special_storage_policy), |
| 384 geofencing_manager_(geofencing_manager), | 386 geofencing_manager_(geofencing_manager), |
| 385 host_zoom_level_context_(host_zoom_level_context) { | 387 host_zoom_level_context_(host_zoom_level_context), |
| 388 navigator_connect_context_(navigator_connect_context) { |
| 386 } | 389 } |
| 387 | 390 |
| 388 StoragePartitionImpl::~StoragePartitionImpl() { | 391 StoragePartitionImpl::~StoragePartitionImpl() { |
| 389 // These message loop checks are just to avoid leaks in unittests. | 392 // These message loop checks are just to avoid leaks in unittests. |
| 390 if (GetDatabaseTracker() && | 393 if (GetDatabaseTracker() && |
| 391 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 394 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 392 BrowserThread::PostTask( | 395 BrowserThread::PostTask( |
| 393 BrowserThread::FILE, | 396 BrowserThread::FILE, |
| 394 FROM_HERE, | 397 FROM_HERE, |
| 395 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); | 398 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 context->GetSpecialStoragePolicy()); | 481 context->GetSpecialStoragePolicy()); |
| 479 | 482 |
| 480 scoped_refptr<GeofencingManager> geofencing_manager = | 483 scoped_refptr<GeofencingManager> geofencing_manager = |
| 481 new GeofencingManager(service_worker_context); | 484 new GeofencingManager(service_worker_context); |
| 482 geofencing_manager->Init(); | 485 geofencing_manager->Init(); |
| 483 | 486 |
| 484 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( | 487 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( |
| 485 new HostZoomLevelContext( | 488 new HostZoomLevelContext( |
| 486 context->CreateZoomLevelDelegate(partition_path))); | 489 context->CreateZoomLevelDelegate(partition_path))); |
| 487 | 490 |
| 488 return new StoragePartitionImpl(partition_path, | 491 scoped_refptr<NavigatorConnectContext> navigator_connect_context = |
| 489 quota_manager.get(), | 492 new NavigatorConnectContext(service_worker_context); |
| 490 appcache_service.get(), | 493 |
| 491 filesystem_context.get(), | 494 return new StoragePartitionImpl( |
| 492 database_tracker.get(), | 495 partition_path, quota_manager.get(), appcache_service.get(), |
| 493 dom_storage_context.get(), | 496 filesystem_context.get(), database_tracker.get(), |
| 494 indexed_db_context.get(), | 497 dom_storage_context.get(), indexed_db_context.get(), |
| 495 service_worker_context.get(), | 498 service_worker_context.get(), webrtc_identity_store.get(), |
| 496 webrtc_identity_store.get(), | 499 special_storage_policy.get(), geofencing_manager.get(), |
| 497 special_storage_policy.get(), | 500 host_zoom_level_context.get(), navigator_connect_context.get()); |
| 498 geofencing_manager.get(), | |
| 499 host_zoom_level_context.get()); | |
| 500 } | 501 } |
| 501 | 502 |
| 502 base::FilePath StoragePartitionImpl::GetPath() { | 503 base::FilePath StoragePartitionImpl::GetPath() { |
| 503 return partition_path_; | 504 return partition_path_; |
| 504 } | 505 } |
| 505 | 506 |
| 506 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 507 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
| 507 return url_request_context_.get(); | 508 return url_request_context_.get(); |
| 508 } | 509 } |
| 509 | 510 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 552 |
| 552 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { | 553 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { |
| 553 return host_zoom_level_context_.get(); | 554 return host_zoom_level_context_.get(); |
| 554 } | 555 } |
| 555 | 556 |
| 556 ZoomLevelDelegate* StoragePartitionImpl::GetZoomLevelDelegate() { | 557 ZoomLevelDelegate* StoragePartitionImpl::GetZoomLevelDelegate() { |
| 557 DCHECK(host_zoom_level_context_.get()); | 558 DCHECK(host_zoom_level_context_.get()); |
| 558 return host_zoom_level_context_->GetZoomLevelDelegate(); | 559 return host_zoom_level_context_->GetZoomLevelDelegate(); |
| 559 } | 560 } |
| 560 | 561 |
| 562 NavigatorConnectContext* StoragePartitionImpl::GetNavigatorConnectContext() { |
| 563 return navigator_connect_context_.get(); |
| 564 } |
| 565 |
| 561 void StoragePartitionImpl::ClearDataImpl( | 566 void StoragePartitionImpl::ClearDataImpl( |
| 562 uint32 remove_mask, | 567 uint32 remove_mask, |
| 563 uint32 quota_storage_remove_mask, | 568 uint32 quota_storage_remove_mask, |
| 564 const GURL& storage_origin, | 569 const GURL& storage_origin, |
| 565 const OriginMatcherFunction& origin_matcher, | 570 const OriginMatcherFunction& origin_matcher, |
| 566 net::URLRequestContextGetter* rq_context, | 571 net::URLRequestContextGetter* rq_context, |
| 567 const base::Time begin, | 572 const base::Time begin, |
| 568 const base::Time end, | 573 const base::Time end, |
| 569 const base::Closure& callback) { | 574 const base::Closure& callback) { |
| 570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 net::URLRequestContextGetter* url_request_context) { | 867 net::URLRequestContextGetter* url_request_context) { |
| 863 url_request_context_ = url_request_context; | 868 url_request_context_ = url_request_context; |
| 864 } | 869 } |
| 865 | 870 |
| 866 void StoragePartitionImpl::SetMediaURLRequestContext( | 871 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 867 net::URLRequestContextGetter* media_url_request_context) { | 872 net::URLRequestContextGetter* media_url_request_context) { |
| 868 media_url_request_context_ = media_url_request_context; | 873 media_url_request_context_ = media_url_request_context; |
| 869 } | 874 } |
| 870 | 875 |
| 871 } // namespace content | 876 } // namespace content |
| OLD | NEW |