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/common/dom_storage/dom_storage_types.h" | 14 #include "content/common/dom_storage/dom_storage_types.h" |
14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/dom_storage_context.h" | 17 #include "content/public/browser/dom_storage_context.h" |
17 #include "content/public/browser/indexed_db_context.h" | 18 #include "content/public/browser/indexed_db_context.h" |
18 #include "content/public/browser/local_storage_usage_info.h" | 19 #include "content/public/browser/local_storage_usage_info.h" |
19 #include "content/public/browser/session_storage_usage_info.h" | 20 #include "content/public/browser/session_storage_usage_info.h" |
20 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
22 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 const base::FilePath& partition_path, | 362 const base::FilePath& partition_path, |
362 storage::QuotaManager* quota_manager, | 363 storage::QuotaManager* quota_manager, |
363 ChromeAppCacheService* appcache_service, | 364 ChromeAppCacheService* appcache_service, |
364 storage::FileSystemContext* filesystem_context, | 365 storage::FileSystemContext* filesystem_context, |
365 storage::DatabaseTracker* database_tracker, | 366 storage::DatabaseTracker* database_tracker, |
366 DOMStorageContextWrapper* dom_storage_context, | 367 DOMStorageContextWrapper* dom_storage_context, |
367 IndexedDBContextImpl* indexed_db_context, | 368 IndexedDBContextImpl* indexed_db_context, |
368 ServiceWorkerContextWrapper* service_worker_context, | 369 ServiceWorkerContextWrapper* service_worker_context, |
369 WebRTCIdentityStore* webrtc_identity_store, | 370 WebRTCIdentityStore* webrtc_identity_store, |
370 storage::SpecialStoragePolicy* special_storage_policy, | 371 storage::SpecialStoragePolicy* special_storage_policy, |
371 GeofencingManager* geofencing_manager) | 372 GeofencingManager* geofencing_manager, |
| 373 HostZoomLevelContext* host_zoom_level_context) |
372 : partition_path_(partition_path), | 374 : partition_path_(partition_path), |
373 quota_manager_(quota_manager), | 375 quota_manager_(quota_manager), |
374 appcache_service_(appcache_service), | 376 appcache_service_(appcache_service), |
375 filesystem_context_(filesystem_context), | 377 filesystem_context_(filesystem_context), |
376 database_tracker_(database_tracker), | 378 database_tracker_(database_tracker), |
377 dom_storage_context_(dom_storage_context), | 379 dom_storage_context_(dom_storage_context), |
378 indexed_db_context_(indexed_db_context), | 380 indexed_db_context_(indexed_db_context), |
379 service_worker_context_(service_worker_context), | 381 service_worker_context_(service_worker_context), |
380 webrtc_identity_store_(webrtc_identity_store), | 382 webrtc_identity_store_(webrtc_identity_store), |
381 special_storage_policy_(special_storage_policy), | 383 special_storage_policy_(special_storage_policy), |
382 geofencing_manager_(geofencing_manager) { | 384 geofencing_manager_(geofencing_manager), |
| 385 host_zoom_level_context_(host_zoom_level_context) { |
383 } | 386 } |
384 | 387 |
385 StoragePartitionImpl::~StoragePartitionImpl() { | 388 StoragePartitionImpl::~StoragePartitionImpl() { |
386 // These message loop checks are just to avoid leaks in unittests. | 389 // These message loop checks are just to avoid leaks in unittests. |
387 if (GetDatabaseTracker() && | 390 if (GetDatabaseTracker() && |
388 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 391 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
389 BrowserThread::PostTask( | 392 BrowserThread::PostTask( |
390 BrowserThread::FILE, | 393 BrowserThread::FILE, |
391 FROM_HERE, | 394 FROM_HERE, |
392 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); | 395 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 474 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
472 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 475 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
473 | 476 |
474 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( | 477 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( |
475 context->GetSpecialStoragePolicy()); | 478 context->GetSpecialStoragePolicy()); |
476 | 479 |
477 scoped_refptr<GeofencingManager> geofencing_manager = | 480 scoped_refptr<GeofencingManager> geofencing_manager = |
478 new GeofencingManager(service_worker_context); | 481 new GeofencingManager(service_worker_context); |
479 geofencing_manager->Init(); | 482 geofencing_manager->Init(); |
480 | 483 |
| 484 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( |
| 485 new HostZoomLevelContext(context->CreateZoomLevelDelegate(), |
| 486 partition_path)); |
| 487 |
481 return new StoragePartitionImpl(partition_path, | 488 return new StoragePartitionImpl(partition_path, |
482 quota_manager.get(), | 489 quota_manager.get(), |
483 appcache_service.get(), | 490 appcache_service.get(), |
484 filesystem_context.get(), | 491 filesystem_context.get(), |
485 database_tracker.get(), | 492 database_tracker.get(), |
486 dom_storage_context.get(), | 493 dom_storage_context.get(), |
487 indexed_db_context.get(), | 494 indexed_db_context.get(), |
488 service_worker_context.get(), | 495 service_worker_context.get(), |
489 webrtc_identity_store.get(), | 496 webrtc_identity_store.get(), |
490 special_storage_policy.get(), | 497 special_storage_policy.get(), |
491 geofencing_manager.get()); | 498 geofencing_manager.get(), |
| 499 host_zoom_level_context.get()); |
492 } | 500 } |
493 | 501 |
494 base::FilePath StoragePartitionImpl::GetPath() { | 502 base::FilePath StoragePartitionImpl::GetPath() { |
495 return partition_path_; | 503 return partition_path_; |
496 } | 504 } |
497 | 505 |
498 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 506 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
499 return url_request_context_.get(); | 507 return url_request_context_.get(); |
500 } | 508 } |
501 | 509 |
(...skipping 27 matching lines...) Expand all Loading... |
529 } | 537 } |
530 | 538 |
531 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 539 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
532 return service_worker_context_.get(); | 540 return service_worker_context_.get(); |
533 } | 541 } |
534 | 542 |
535 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { | 543 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { |
536 return geofencing_manager_.get(); | 544 return geofencing_manager_.get(); |
537 } | 545 } |
538 | 546 |
| 547 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 548 DCHECK(host_zoom_level_context_.get()); |
| 549 return host_zoom_level_context_->GetHostZoomMap(); |
| 550 } |
| 551 |
| 552 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { |
| 553 return host_zoom_level_context_.get(); |
| 554 } |
| 555 |
| 556 ZoomLevelDelegate* StoragePartitionImpl::GetZoomLevelDelegate() { |
| 557 DCHECK(host_zoom_level_context_.get()); |
| 558 return host_zoom_level_context_->GetZoomLevelDelegate(); |
| 559 } |
| 560 |
539 void StoragePartitionImpl::ClearDataImpl( | 561 void StoragePartitionImpl::ClearDataImpl( |
540 uint32 remove_mask, | 562 uint32 remove_mask, |
541 uint32 quota_storage_remove_mask, | 563 uint32 quota_storage_remove_mask, |
542 const GURL& storage_origin, | 564 const GURL& storage_origin, |
543 const OriginMatcherFunction& origin_matcher, | 565 const OriginMatcherFunction& origin_matcher, |
544 net::URLRequestContextGetter* rq_context, | 566 net::URLRequestContextGetter* rq_context, |
545 const base::Time begin, | 567 const base::Time begin, |
546 const base::Time end, | 568 const base::Time end, |
547 const base::Closure& callback) { | 569 const base::Closure& callback) { |
548 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 net::URLRequestContextGetter* url_request_context) { | 862 net::URLRequestContextGetter* url_request_context) { |
841 url_request_context_ = url_request_context; | 863 url_request_context_ = url_request_context; |
842 } | 864 } |
843 | 865 |
844 void StoragePartitionImpl::SetMediaURLRequestContext( | 866 void StoragePartitionImpl::SetMediaURLRequestContext( |
845 net::URLRequestContextGetter* media_url_request_context) { | 867 net::URLRequestContextGetter* media_url_request_context) { |
846 media_url_request_context_ = media_url_request_context; | 868 media_url_request_context_ = media_url_request_context; |
847 } | 869 } |
848 | 870 |
849 } // namespace content | 871 } // namespace content |
OLD | NEW |