| 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/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/resource_context.h" | 10 #include "content/public/browser/resource_context.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 13 #include "webkit/appcache/appcache_storage_impl.h" |
| 12 #include "webkit/quota/quota_manager.h" | 14 #include "webkit/quota/quota_manager.h" |
| 13 | 15 |
| 14 using content::BrowserThread; | 16 using content::BrowserThread; |
| 15 | 17 |
| 16 ChromeAppCacheService::ChromeAppCacheService( | 18 ChromeAppCacheService::ChromeAppCacheService( |
| 17 quota::QuotaManagerProxy* quota_manager_proxy) | 19 quota::QuotaManagerProxy* quota_manager_proxy) |
| 18 : AppCacheService(quota_manager_proxy), | 20 : AppCacheService(quota_manager_proxy), |
| 19 resource_context_(NULL) { | 21 resource_context_(NULL) { |
| 20 } | 22 } |
| 21 | 23 |
| 22 void ChromeAppCacheService::InitializeOnIOThread( | 24 void ChromeAppCacheService::InitializeOnIOThread( |
| 23 const FilePath& cache_path, | 25 const FilePath& cache_path, |
| 24 content::ResourceContext* resource_context, | 26 content::ResourceContext* resource_context, |
| 27 net::URLRequestContextGetter* request_context_getter, |
| 25 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { | 28 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { |
| 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 27 | 30 |
| 28 cache_path_ = cache_path; | 31 cache_path_ = cache_path; |
| 29 resource_context_ = resource_context; | 32 resource_context_ = resource_context; |
| 30 set_request_context(resource_context->GetRequestContext()); | 33 |
| 34 set_request_context(request_context_getter->GetURLRequestContext()); |
| 31 | 35 |
| 32 // Init our base class. | 36 // Init our base class. |
| 33 Initialize( | 37 Initialize( |
| 34 cache_path_, | 38 cache_path_, |
| 35 BrowserThread::GetMessageLoopProxyForThread( | 39 BrowserThread::GetMessageLoopProxyForThread( |
| 36 BrowserThread::FILE_USER_BLOCKING), | 40 BrowserThread::FILE_USER_BLOCKING), |
| 37 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 41 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 38 set_appcache_policy(this); | 42 set_appcache_policy(this); |
| 39 set_special_storage_policy(special_storage_policy); | 43 set_special_storage_policy(special_storage_policy); |
| 40 } | 44 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 ChromeAppCacheService::~ChromeAppCacheService() {} | 61 ChromeAppCacheService::~ChromeAppCacheService() {} |
| 58 | 62 |
| 59 void ChromeAppCacheService::DeleteOnCorrectThread() const { | 63 void ChromeAppCacheService::DeleteOnCorrectThread() const { |
| 60 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | 64 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
| 61 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 65 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 62 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 66 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
| 63 return; | 67 return; |
| 64 } | 68 } |
| 65 delete this; | 69 delete this; |
| 66 } | 70 } |
| OLD | NEW |