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/resource_context.h" | 10 #include "content/public/browser/resource_context.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Init our base class. | 32 // Init our base class. |
33 Initialize( | 33 Initialize( |
34 cache_path_, | 34 cache_path_, |
35 BrowserThread::GetMessageLoopProxyForThread( | 35 BrowserThread::GetMessageLoopProxyForThread( |
36 BrowserThread::FILE_USER_BLOCKING), | 36 BrowserThread::FILE_USER_BLOCKING), |
37 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 37 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
38 set_appcache_policy(this); | 38 set_appcache_policy(this); |
39 set_special_storage_policy(special_storage_policy); | 39 set_special_storage_policy(special_storage_policy); |
40 } | 40 } |
41 | 41 |
42 ChromeAppCacheService::~ChromeAppCacheService() { | |
43 } | |
44 | |
45 void ChromeAppCacheService::DeleteOnCorrectThread() const { | |
46 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | |
47 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | |
48 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | |
49 return; | |
50 } | |
51 delete this; | |
52 } | |
53 | |
54 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, | 42 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, |
55 const GURL& first_party) { | 43 const GURL& first_party) { |
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
57 // We don't prompt for read access. | 45 // We don't prompt for read access. |
58 return content::GetContentClient()->browser()->AllowAppCache( | 46 return content::GetContentClient()->browser()->AllowAppCache( |
59 manifest_url, first_party, resource_context_); | 47 manifest_url, first_party, resource_context_); |
60 } | 48 } |
61 | 49 |
62 bool ChromeAppCacheService::CanCreateAppCache( | 50 bool ChromeAppCacheService::CanCreateAppCache( |
63 const GURL& manifest_url, const GURL& first_party) { | 51 const GURL& manifest_url, const GURL& first_party) { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
65 return content::GetContentClient()->browser()->AllowAppCache( | 53 return content::GetContentClient()->browser()->AllowAppCache( |
66 manifest_url, first_party, resource_context_); | 54 manifest_url, first_party, resource_context_); |
67 } | 55 } |
| 56 |
| 57 ChromeAppCacheService::~ChromeAppCacheService() {} |
| 58 |
| 59 void ChromeAppCacheService::DeleteOnCorrectThread() const { |
| 60 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
| 61 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 62 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
| 63 return; |
| 64 } |
| 65 delete this; |
| 66 } |
OLD | NEW |