| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/appcache/chrome_appcache_service.h" | 5 #include "content/browser/appcache/chrome_appcache_service.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "content/browser/content_browser_client.h" | 9 #include "content/browser/content_browser_client.h" |
| 10 #include "content/common/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| 11 #include "content/public/browser/notification_types.h" | 11 #include "content/public/browser/notification_types.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "webkit/quota/quota_manager.h" | 13 #include "webkit/quota/quota_manager.h" |
| 14 | 14 |
| 15 ChromeAppCacheService::ChromeAppCacheService( | 15 ChromeAppCacheService::ChromeAppCacheService( |
| 16 quota::QuotaManagerProxy* quota_manager_proxy) | 16 quota::QuotaManagerProxy* quota_manager_proxy) |
| 17 : AppCacheService(quota_manager_proxy), | 17 : AppCacheService(quota_manager_proxy), |
| 18 resource_context_(NULL) { | 18 resource_context_(NULL) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void ChromeAppCacheService::InitializeOnIOThread( | 21 void ChromeAppCacheService::InitializeOnIOThread( |
| 22 const FilePath& cache_path, | 22 const FilePath& cache_path, |
| 23 const content::ResourceContext* resource_context, | 23 const content::ResourceContext* resource_context, |
| 24 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { | 24 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { |
| 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 26 | 26 |
| 27 cache_path_ = cache_path; | 27 cache_path_ = cache_path; |
| 28 resource_context_ = resource_context; | 28 resource_context_ = resource_context; |
| 29 registrar_.Add( | 29 registrar_.Add( |
| 30 this, content::NOTIFICATION_PURGE_MEMORY, | 30 this, content::NOTIFICATION_PURGE_MEMORY, |
| 31 NotificationService::AllSources()); | 31 content::NotificationService::AllSources()); |
| 32 | 32 |
| 33 // Init our base class. | 33 // Init our base class. |
| 34 Initialize(cache_path_, | 34 Initialize(cache_path_, |
| 35 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 35 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
| 36 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 36 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 37 set_appcache_policy(this); | 37 set_appcache_policy(this); |
| 38 set_special_storage_policy(special_storage_policy); | 38 set_special_storage_policy(special_storage_policy); |
| 39 } | 39 } |
| 40 | 40 |
| 41 ChromeAppCacheService::~ChromeAppCacheService() { | 41 ChromeAppCacheService::~ChromeAppCacheService() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ChromeAppCacheService::Observe( | 59 void ChromeAppCacheService::Observe( |
| 60 int type, | 60 int type, |
| 61 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
| 62 const content::NotificationDetails& details) { | 62 const content::NotificationDetails& details) { |
| 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 64 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); | 64 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); |
| 65 PurgeMemory(); | 65 PurgeMemory(); |
| 66 } | 66 } |
| OLD | NEW |