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_map_impl.h" |
12 #include "content/common/dom_storage/dom_storage_types.h" | 13 #include "content/common/dom_storage/dom_storage_types.h" |
13 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/dom_storage_context.h" | 16 #include "content/public/browser/dom_storage_context.h" |
16 #include "content/public/browser/indexed_db_context.h" | 17 #include "content/public/browser/indexed_db_context.h" |
17 #include "content/public/browser/local_storage_usage_info.h" | 18 #include "content/public/browser/local_storage_usage_info.h" |
18 #include "content/public/browser/session_storage_usage_info.h" | 19 #include "content/public/browser/session_storage_usage_info.h" |
19 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
21 #include "net/cookies/cookie_monster.h" | 22 #include "net/cookies/cookie_monster.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 StoragePartitionImpl::StoragePartitionImpl( | 356 StoragePartitionImpl::StoragePartitionImpl( |
356 const base::FilePath& partition_path, | 357 const base::FilePath& partition_path, |
357 storage::QuotaManager* quota_manager, | 358 storage::QuotaManager* quota_manager, |
358 ChromeAppCacheService* appcache_service, | 359 ChromeAppCacheService* appcache_service, |
359 storage::FileSystemContext* filesystem_context, | 360 storage::FileSystemContext* filesystem_context, |
360 storage::DatabaseTracker* database_tracker, | 361 storage::DatabaseTracker* database_tracker, |
361 DOMStorageContextWrapper* dom_storage_context, | 362 DOMStorageContextWrapper* dom_storage_context, |
362 IndexedDBContextImpl* indexed_db_context, | 363 IndexedDBContextImpl* indexed_db_context, |
363 ServiceWorkerContextWrapper* service_worker_context, | 364 ServiceWorkerContextWrapper* service_worker_context, |
364 WebRTCIdentityStore* webrtc_identity_store, | 365 WebRTCIdentityStore* webrtc_identity_store, |
365 storage::SpecialStoragePolicy* special_storage_policy) | 366 storage::SpecialStoragePolicy* special_storage_policy, |
| 367 HostZoomLevelContext* host_zoom_level_context) |
366 : partition_path_(partition_path), | 368 : partition_path_(partition_path), |
367 quota_manager_(quota_manager), | 369 quota_manager_(quota_manager), |
368 appcache_service_(appcache_service), | 370 appcache_service_(appcache_service), |
369 filesystem_context_(filesystem_context), | 371 filesystem_context_(filesystem_context), |
370 database_tracker_(database_tracker), | 372 database_tracker_(database_tracker), |
371 dom_storage_context_(dom_storage_context), | 373 dom_storage_context_(dom_storage_context), |
372 indexed_db_context_(indexed_db_context), | 374 indexed_db_context_(indexed_db_context), |
373 service_worker_context_(service_worker_context), | 375 service_worker_context_(service_worker_context), |
374 webrtc_identity_store_(webrtc_identity_store), | 376 webrtc_identity_store_(webrtc_identity_store), |
375 special_storage_policy_(special_storage_policy) { | 377 special_storage_policy_(special_storage_policy), |
376 } | 378 host_zoom_level_context_(host_zoom_level_context) {} |
377 | 379 |
378 StoragePartitionImpl::~StoragePartitionImpl() { | 380 StoragePartitionImpl::~StoragePartitionImpl() { |
379 // These message loop checks are just to avoid leaks in unittests. | 381 // These message loop checks are just to avoid leaks in unittests. |
380 if (GetDatabaseTracker() && | 382 if (GetDatabaseTracker() && |
381 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 383 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
382 BrowserThread::PostTask( | 384 BrowserThread::PostTask( |
383 BrowserThread::FILE, | 385 BrowserThread::FILE, |
384 FROM_HERE, | 386 FROM_HERE, |
385 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); | 387 base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker())); |
386 } | 388 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 458 |
457 scoped_refptr<ChromeAppCacheService> appcache_service = | 459 scoped_refptr<ChromeAppCacheService> appcache_service = |
458 new ChromeAppCacheService(quota_manager->proxy()); | 460 new ChromeAppCacheService(quota_manager->proxy()); |
459 | 461 |
460 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 462 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
461 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 463 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
462 | 464 |
463 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( | 465 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( |
464 context->GetSpecialStoragePolicy()); | 466 context->GetSpecialStoragePolicy()); |
465 | 467 |
| 468 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( |
| 469 new HostZoomLevelContext(context->CreateZoomLevelPrefsStore(), |
| 470 partition_path)); |
| 471 |
466 return new StoragePartitionImpl(partition_path, | 472 return new StoragePartitionImpl(partition_path, |
467 quota_manager.get(), | 473 quota_manager.get(), |
468 appcache_service.get(), | 474 appcache_service.get(), |
469 filesystem_context.get(), | 475 filesystem_context.get(), |
470 database_tracker.get(), | 476 database_tracker.get(), |
471 dom_storage_context.get(), | 477 dom_storage_context.get(), |
472 indexed_db_context.get(), | 478 indexed_db_context.get(), |
473 service_worker_context.get(), | 479 service_worker_context.get(), |
474 webrtc_identity_store.get(), | 480 webrtc_identity_store.get(), |
475 special_storage_policy.get()); | 481 special_storage_policy.get(), |
| 482 host_zoom_level_context.get()); |
476 } | 483 } |
477 | 484 |
478 base::FilePath StoragePartitionImpl::GetPath() { | 485 base::FilePath StoragePartitionImpl::GetPath() { |
479 return partition_path_; | 486 return partition_path_; |
480 } | 487 } |
481 | 488 |
482 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 489 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
483 return url_request_context_.get(); | 490 return url_request_context_.get(); |
484 } | 491 } |
485 | 492 |
(...skipping 23 matching lines...) Expand all Loading... |
509 } | 516 } |
510 | 517 |
511 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 518 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
512 return indexed_db_context_.get(); | 519 return indexed_db_context_.get(); |
513 } | 520 } |
514 | 521 |
515 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 522 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
516 return service_worker_context_.get(); | 523 return service_worker_context_.get(); |
517 } | 524 } |
518 | 525 |
| 526 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 527 DCHECK(host_zoom_level_context_); |
| 528 return host_zoom_level_context_->GetHostZoomMap(); |
| 529 } |
| 530 |
| 531 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { |
| 532 return host_zoom_level_context_.get(); |
| 533 } |
| 534 |
| 535 PrefService* StoragePartitionImpl::GetZoomLevelPrefs() { |
| 536 DCHECK(host_zoom_level_context_); |
| 537 return host_zoom_level_context_->GetZoomLevelPrefs(); |
| 538 } |
| 539 |
519 void StoragePartitionImpl::ClearDataImpl( | 540 void StoragePartitionImpl::ClearDataImpl( |
520 uint32 remove_mask, | 541 uint32 remove_mask, |
521 uint32 quota_storage_remove_mask, | 542 uint32 quota_storage_remove_mask, |
522 const GURL& storage_origin, | 543 const GURL& storage_origin, |
523 const OriginMatcherFunction& origin_matcher, | 544 const OriginMatcherFunction& origin_matcher, |
524 net::URLRequestContextGetter* rq_context, | 545 net::URLRequestContextGetter* rq_context, |
525 const base::Time begin, | 546 const base::Time begin, |
526 const base::Time end, | 547 const base::Time end, |
527 const base::Closure& callback) { | 548 const base::Closure& callback) { |
528 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 549 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 net::URLRequestContextGetter* url_request_context) { | 835 net::URLRequestContextGetter* url_request_context) { |
815 url_request_context_ = url_request_context; | 836 url_request_context_ = url_request_context; |
816 } | 837 } |
817 | 838 |
818 void StoragePartitionImpl::SetMediaURLRequestContext( | 839 void StoragePartitionImpl::SetMediaURLRequestContext( |
819 net::URLRequestContextGetter* media_url_request_context) { | 840 net::URLRequestContextGetter* media_url_request_context) { |
820 media_url_request_context_ = media_url_request_context; | 841 media_url_request_context_ = media_url_request_context; |
821 } | 842 } |
822 | 843 |
823 } // namespace content | 844 } // namespace content |
OLD | NEW |