Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: content/browser/appcache/chrome_appcache_service.cc

Issue 9369009: Make content::ResourceContext be a real interface like the rest of the Content API (i.e. don't ha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "webkit/quota/quota_manager.h" 13 #include "webkit/quota/quota_manager.h"
14 14
15 using content::BrowserThread; 15 using content::BrowserThread;
16 16
17 ChromeAppCacheService::ChromeAppCacheService( 17 ChromeAppCacheService::ChromeAppCacheService(
18 quota::QuotaManagerProxy* quota_manager_proxy) 18 quota::QuotaManagerProxy* quota_manager_proxy)
19 : AppCacheService(quota_manager_proxy), 19 : AppCacheService(quota_manager_proxy),
20 resource_context_(NULL) { 20 resource_context_(NULL) {
21 } 21 }
22 22
23 void ChromeAppCacheService::InitializeOnIOThread( 23 void ChromeAppCacheService::InitializeOnIOThread(
24 const FilePath& cache_path, 24 const FilePath& cache_path,
25 const content::ResourceContext* resource_context, 25 content::ResourceContext* resource_context,
26 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { 26 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) {
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
28 28
29 cache_path_ = cache_path; 29 cache_path_ = cache_path;
30 resource_context_ = resource_context; 30 resource_context_ = resource_context;
31 registrar_.Add( 31 registrar_.Add(
32 this, content::NOTIFICATION_PURGE_MEMORY, 32 this, content::NOTIFICATION_PURGE_MEMORY,
33 content::NotificationService::AllSources()); 33 content::NotificationService::AllSources());
34 34
35 // Init our base class. 35 // Init our base class.
36 Initialize( 36 Initialize(
37 cache_path_, 37 cache_path_,
38 BrowserThread::GetMessageLoopProxyForThread( 38 BrowserThread::GetMessageLoopProxyForThread(
39 BrowserThread::FILE_USER_BLOCKING), 39 BrowserThread::FILE_USER_BLOCKING),
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
41 set_appcache_policy(this); 41 set_appcache_policy(this);
42 set_special_storage_policy(special_storage_policy); 42 set_special_storage_policy(special_storage_policy);
43 } 43 }
44 44
45 ChromeAppCacheService::~ChromeAppCacheService() { 45 ChromeAppCacheService::~ChromeAppCacheService() {
46 } 46 }
47 47
48 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, 48 bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url,
49 const GURL& first_party) { 49 const GURL& first_party) {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
51 // We don't prompt for read access. 51 // We don't prompt for read access.
52 return content::GetContentClient()->browser()->AllowAppCache( 52 return content::GetContentClient()->browser()->AllowAppCache(
53 manifest_url, first_party, *resource_context_); 53 manifest_url, first_party, resource_context_);
54 } 54 }
55 55
56 bool ChromeAppCacheService::CanCreateAppCache( 56 bool ChromeAppCacheService::CanCreateAppCache(
57 const GURL& manifest_url, const GURL& first_party) { 57 const GURL& manifest_url, const GURL& first_party) {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
59 return content::GetContentClient()->browser()->AllowAppCache( 59 return content::GetContentClient()->browser()->AllowAppCache(
60 manifest_url, first_party, *resource_context_); 60 manifest_url, first_party, resource_context_);
61 } 61 }
62 62
63 void ChromeAppCacheService::Observe( 63 void ChromeAppCacheService::Observe(
64 int type, 64 int type,
65 const content::NotificationSource& source, 65 const content::NotificationSource& source,
66 const content::NotificationDetails& details) { 66 const content::NotificationDetails& details) {
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
68 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); 68 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY);
69 PurgeMemory(); 69 PurgeMemory();
70 } 70 }
OLDNEW
« no previous file with comments | « content/browser/appcache/chrome_appcache_service.h ('k') | content/browser/appcache/chrome_appcache_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698