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 "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "content/browser/appcache/appcache_storage_impl.h" | 9 #include "content/browser/appcache/appcache_storage_impl.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // The |request_context_getter| can be NULL in some unit tests. | 38 // The |request_context_getter| can be NULL in some unit tests. |
39 // | 39 // |
40 // TODO(ajwong): TestProfile is difficult to work with. The | 40 // TODO(ajwong): TestProfile is difficult to work with. The |
41 // SafeBrowsing tests require that GetRequestContext return NULL | 41 // SafeBrowsing tests require that GetRequestContext return NULL |
42 // so we can't depend on having a non-NULL value here. See crbug/149783. | 42 // so we can't depend on having a non-NULL value here. See crbug/149783. |
43 if (request_context_getter) | 43 if (request_context_getter) |
44 set_request_context(request_context_getter->GetURLRequestContext()); | 44 set_request_context(request_context_getter->GetURLRequestContext()); |
45 | 45 |
46 // Init our base class. | 46 // Init our base class. |
47 Initialize( | 47 Initialize(cache_path_, BrowserThread::GetTaskRunnerForThread( |
48 cache_path_, | 48 BrowserThread::FILE_USER_BLOCKING) |
49 BrowserThread::GetMessageLoopProxyForThread( | 49 .get(), |
50 BrowserThread::FILE_USER_BLOCKING) | 50 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE).get()); |
51 .get(), | |
52 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE).get()); | |
53 set_appcache_policy(this); | 51 set_appcache_policy(this); |
54 set_special_storage_policy(special_storage_policy.get()); | 52 set_special_storage_policy(special_storage_policy.get()); |
55 } | 53 } |
56 | 54 |
57 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, | 55 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, |
58 const GURL& first_party) { | 56 const GURL& first_party) { |
59 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 57 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
60 // We don't prompt for read access. | 58 // We don't prompt for read access. |
61 return GetContentClient()->browser()->AllowAppCache( | 59 return GetContentClient()->browser()->AllowAppCache( |
62 manifest_url, first_party, resource_context_); | 60 manifest_url, first_party, resource_context_); |
(...skipping 14 matching lines...) Expand all Loading... |
77 return; | 75 return; |
78 } | 76 } |
79 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 77 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
80 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 78 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
81 return; | 79 return; |
82 } | 80 } |
83 // Better to leak than crash on shutdown. | 81 // Better to leak than crash on shutdown. |
84 } | 82 } |
85 | 83 |
86 } // namespace content | 84 } // namespace content |
OLD | NEW |