| 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/browser/content_browser_client.h" | 9 #include "content/browser/content_browser_client.h" |
| 10 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Init our base class. | 42 // Init our base class. |
| 43 Initialize(cache_path_, | 43 Initialize(cache_path_, |
| 44 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 44 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 45 set_appcache_policy(this); | 45 set_appcache_policy(this); |
| 46 set_special_storage_policy(special_storage_policy); | 46 set_special_storage_policy(special_storage_policy); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ChromeAppCacheService::~ChromeAppCacheService() { | 49 ChromeAppCacheService::~ChromeAppCacheService() { |
| 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 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 54 // We don't prompt for read access. | 55 // We don't prompt for read access. |
| 55 return content::GetContentClient()->browser()->AllowAppCache( | 56 return content::GetContentClient()->browser()->AllowAppCache( |
| 56 manifest_url, *resource_context_); | 57 manifest_url, first_party, *resource_context_); |
| 57 } | 58 } |
| 58 | 59 |
| 59 int ChromeAppCacheService::CanCreateAppCache( | 60 bool ChromeAppCacheService::CanCreateAppCache( |
| 60 const GURL& manifest_url, net::CompletionCallback* callback) { | 61 const GURL& manifest_url, const GURL& first_party) { |
| 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 62 return content::GetContentClient()->browser()->AllowAppCache( | 63 return content::GetContentClient()->browser()->AllowAppCache( |
| 63 manifest_url, *resource_context_) ? net::OK : net::ERR_ACCESS_DENIED; | 64 manifest_url, first_party, *resource_context_); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void ChromeAppCacheService::Observe(int type, | 67 void ChromeAppCacheService::Observe(int type, |
| 67 const NotificationSource& source, | 68 const NotificationSource& source, |
| 68 const NotificationDetails& details) { | 69 const NotificationDetails& details) { |
| 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 70 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); | 71 DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); |
| 71 PurgeMemory(); | 72 PurgeMemory(); |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 const tracked_objects::Location& from_here, | 89 const tracked_objects::Location& from_here, |
| 89 Task* task) { | 90 Task* task) { |
| 90 return BrowserThread::PostTask(ToBrowserThreadID(id), from_here, task); | 91 return BrowserThread::PostTask(ToBrowserThreadID(id), from_here, task); |
| 91 } | 92 } |
| 92 | 93 |
| 93 bool AppCacheThread::CurrentlyOn(int id) { | 94 bool AppCacheThread::CurrentlyOn(int id) { |
| 94 return BrowserThread::CurrentlyOn(ToBrowserThreadID(id)); | 95 return BrowserThread::CurrentlyOn(ToBrowserThreadID(id)); |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace appcache | 98 } // namespace appcache |
| OLD | NEW |