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/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/browser/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 "content/public/browser/resource_context.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 #include "webkit/quota/quota_manager.h" | 14 #include "webkit/quota/quota_manager.h" |
14 | 15 |
15 using content::BrowserThread; | 16 using content::BrowserThread; |
16 | 17 |
17 ChromeAppCacheService::ChromeAppCacheService( | 18 ChromeAppCacheService::ChromeAppCacheService( |
18 quota::QuotaManagerProxy* quota_manager_proxy) | 19 quota::QuotaManagerProxy* quota_manager_proxy) |
19 : AppCacheService(quota_manager_proxy), | 20 : AppCacheService(quota_manager_proxy), |
20 resource_context_(NULL) { | 21 resource_context_(NULL) { |
21 } | 22 } |
22 | 23 |
23 void ChromeAppCacheService::InitializeOnIOThread( | 24 void ChromeAppCacheService::InitializeOnIOThread( |
24 const FilePath& cache_path, | 25 const FilePath& cache_path, |
25 content::ResourceContext* resource_context, | 26 content::ResourceContext* resource_context, |
26 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { | 27 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { |
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
28 | 29 |
29 cache_path_ = cache_path; | 30 cache_path_ = cache_path; |
30 resource_context_ = resource_context; | 31 resource_context_ = resource_context; |
| 32 set_request_context(resource_context->GetRequestContext()); |
31 registrar_.Add( | 33 registrar_.Add( |
32 this, content::NOTIFICATION_PURGE_MEMORY, | 34 this, content::NOTIFICATION_PURGE_MEMORY, |
33 content::NotificationService::AllSources()); | 35 content::NotificationService::AllSources()); |
34 | 36 |
35 // Init our base class. | 37 // Init our base class. |
36 Initialize( | 38 Initialize( |
37 cache_path_, | 39 cache_path_, |
38 BrowserThread::GetMessageLoopProxyForThread( | 40 BrowserThread::GetMessageLoopProxyForThread( |
39 BrowserThread::FILE_USER_BLOCKING), | 41 BrowserThread::FILE_USER_BLOCKING), |
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 42 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
(...skipping 29 matching lines...) Expand all Loading... |
70 } | 72 } |
71 | 73 |
72 void ChromeAppCacheService::Observe( | 74 void ChromeAppCacheService::Observe( |
73 int type, | 75 int type, |
74 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
75 const content::NotificationDetails& details) { | 77 const content::NotificationDetails& details) { |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
77 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); | 79 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); |
78 PurgeMemory(); | 80 PurgeMemory(); |
79 } | 81 } |
OLD | NEW |