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 #ifndef CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
12 #include "content/common/content_export.h" | |
11 #include "content/common/notification_observer.h" | 13 #include "content/common/notification_observer.h" |
12 #include "content/common/notification_registrar.h" | 14 #include "content/common/notification_registrar.h" |
13 #include "webkit/appcache/appcache_policy.h" | 15 #include "webkit/appcache/appcache_policy.h" |
14 #include "webkit/appcache/appcache_service.h" | 16 #include "webkit/appcache/appcache_service.h" |
15 #include "webkit/quota/special_storage_policy.h" | 17 #include "webkit/quota/special_storage_policy.h" |
16 | 18 |
17 class FilePath; | 19 class FilePath; |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 class ResourceContext; | 22 class ResourceContext; |
21 } | 23 } |
22 | 24 |
23 // An AppCacheService subclass used by the chrome. There is an instance | 25 // An AppCacheService subclass used by the chrome. There is an instance |
24 // associated with each BrowserContext. This derivation adds refcounting | 26 // associated with each BrowserContext. This derivation adds refcounting |
25 // semantics since a browser context has multiple URLRequestContexts which refer | 27 // semantics since a browser context has multiple URLRequestContexts which refer |
26 // to the same object, and those URLRequestContexts are refcounted independently | 28 // to the same object, and those URLRequestContexts are refcounted independently |
27 // of the owning browser context. | 29 // of the owning browser context. |
28 // | 30 // |
29 // All methods, except the ctor, are expected to be called on | 31 // All methods, except the ctor, are expected to be called on |
30 // the IO thread (unless specifically called out in doc comments). | 32 // the IO thread (unless specifically called out in doc comments). |
31 class ChromeAppCacheService | 33 class CONTENT_EXPORT ChromeAppCacheService |
32 : public base::RefCountedThreadSafe<ChromeAppCacheService, | 34 : public base::RefCountedThreadSafe<ChromeAppCacheService, |
33 BrowserThread::DeleteOnIOThread>, | 35 BrowserThread::DeleteOnIOThread>, |
34 public appcache::AppCacheService, | 36 NON_EXPORTED_BASE(public appcache::AppCacheService), |
darin (slow to review)
2011/09/04 15:41:04
the risk here is that someone outside of content m
Dirk Pranke
2011/09/07 01:46:07
I will add a TODO for now and come back to this in
| |
35 public appcache::AppCachePolicy, | 37 NON_EXPORTED_BASE(public appcache::AppCachePolicy), |
36 public NotificationObserver { | 38 public NotificationObserver { |
37 public: | 39 public: |
38 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); | 40 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); |
39 | 41 |
40 void InitializeOnIOThread( | 42 void InitializeOnIOThread( |
41 const FilePath& cache_path, // may be empty to use in-memory structures | 43 const FilePath& cache_path, // may be empty to use in-memory structures |
42 const content::ResourceContext* resource_context, | 44 const content::ResourceContext* resource_context, |
43 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 45 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
44 | 46 |
45 private: | 47 private: |
48 friend base::RefCountedThreadSafe<ChromeAppCacheService, | |
49 BrowserThread::DeleteOnIOThread>; | |
46 friend class BrowserThread; | 50 friend class BrowserThread; |
47 friend class DeleteTask<ChromeAppCacheService>; | 51 friend class DeleteTask<ChromeAppCacheService>; |
48 | 52 |
49 virtual ~ChromeAppCacheService(); | 53 virtual ~ChromeAppCacheService(); |
50 | 54 |
51 // AppCachePolicy overrides | 55 // AppCachePolicy overrides |
52 virtual bool CanLoadAppCache(const GURL& manifest_url); | 56 virtual bool CanLoadAppCache(const GURL& manifest_url); |
53 virtual int CanCreateAppCache(const GURL& manifest_url, | 57 virtual int CanCreateAppCache(const GURL& manifest_url, |
54 net::CompletionCallback* callback); | 58 net::CompletionCallback* callback); |
55 | 59 |
56 // NotificationObserver override | 60 // NotificationObserver override |
57 virtual void Observe(int type, | 61 virtual void Observe(int type, |
58 const NotificationSource& source, | 62 const NotificationSource& source, |
59 const NotificationDetails& details); | 63 const NotificationDetails& details); |
60 | 64 |
61 const content::ResourceContext* resource_context_; | 65 const content::ResourceContext* resource_context_; |
62 NotificationRegistrar registrar_; | 66 NotificationRegistrar registrar_; |
63 FilePath cache_path_; | 67 FilePath cache_path_; |
64 | 68 |
65 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); | 69 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); |
66 }; | 70 }; |
67 | 71 |
68 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 72 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
OLD | NEW |