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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.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 28 matching lines...) Expand all Loading... |
39 if (request_context_getter) | 39 if (request_context_getter) |
40 set_request_context(request_context_getter->GetURLRequestContext()); | 40 set_request_context(request_context_getter->GetURLRequestContext()); |
41 | 41 |
42 // Init our base class. | 42 // Init our base class. |
43 Initialize( | 43 Initialize( |
44 cache_path_, | 44 cache_path_, |
45 BrowserThread::GetMessageLoopProxyForThread( | 45 BrowserThread::GetMessageLoopProxyForThread( |
46 BrowserThread::FILE_USER_BLOCKING), | 46 BrowserThread::FILE_USER_BLOCKING), |
47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
48 set_appcache_policy(this); | 48 set_appcache_policy(this); |
49 set_special_storage_policy(special_storage_policy); | 49 set_special_storage_policy(special_storage_policy.get()); |
50 } | 50 } |
51 | 51 |
52 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, | 52 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, |
53 const GURL& first_party) { | 53 const GURL& first_party) { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
55 // We don't prompt for read access. | 55 // We don't prompt for read access. |
56 return GetContentClient()->browser()->AllowAppCache( | 56 return GetContentClient()->browser()->AllowAppCache( |
57 manifest_url, first_party, resource_context_); | 57 manifest_url, first_party, resource_context_); |
58 } | 58 } |
59 | 59 |
60 bool ChromeAppCacheService::CanCreateAppCache( | 60 bool ChromeAppCacheService::CanCreateAppCache( |
61 const GURL& manifest_url, const GURL& first_party) { | 61 const GURL& manifest_url, const GURL& first_party) { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
63 return GetContentClient()->browser()->AllowAppCache( | 63 return GetContentClient()->browser()->AllowAppCache( |
64 manifest_url, first_party, resource_context_); | 64 manifest_url, first_party, resource_context_); |
65 } | 65 } |
66 | 66 |
67 ChromeAppCacheService::~ChromeAppCacheService() {} | 67 ChromeAppCacheService::~ChromeAppCacheService() {} |
68 | 68 |
69 void ChromeAppCacheService::DeleteOnCorrectThread() const { | 69 void ChromeAppCacheService::DeleteOnCorrectThread() const { |
70 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | 70 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
71 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 71 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
72 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 72 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
73 return; | 73 return; |
74 } | 74 } |
75 delete this; | 75 delete this; |
76 } | 76 } |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
OLD | NEW |