OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "testing/gtest/include/gtest/gtest_prod.h" | 17 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 18 #include "webkit/appcache/appcache_interfaces.h" |
18 #include "webkit/appcache/appcache_storage.h" | 19 #include "webkit/appcache/appcache_storage.h" |
19 | 20 |
20 class URLRequestContext; | 21 class URLRequestContext; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class MessageLoopProxy; | 24 class MessageLoopProxy; |
24 } | 25 } |
25 | 26 |
26 namespace appcache { | 27 namespace appcache { |
27 | 28 |
28 class AppCacheBackendImpl; | 29 class AppCacheBackendImpl; |
29 class AppCachePolicy; | 30 class AppCachePolicy; |
30 | 31 |
31 // Structure that contains basic info about an appcache. | |
32 struct AppCacheInfo { | |
33 AppCacheInfo() {} | |
34 AppCacheInfo(const GURL& manifest_url, | |
35 int64 size, | |
36 base::Time creation_time, | |
37 base::Time last_access_time, | |
38 base::Time last_update_time) | |
39 : manifest_url(manifest_url), | |
40 size(size), | |
41 creation_time(creation_time), | |
42 last_access_time(last_access_time), | |
43 last_update_time(last_update_time) { | |
44 } | |
45 GURL manifest_url; | |
46 int64 size; | |
47 base::Time creation_time; | |
48 base::Time last_access_time; | |
49 base::Time last_update_time; | |
50 }; | |
51 | |
52 typedef std::vector<AppCacheInfo> AppCacheInfoVector; | |
53 | |
54 // Refcounted container to avoid copying the collection in callbacks. | 32 // Refcounted container to avoid copying the collection in callbacks. |
55 struct AppCacheInfoCollection | 33 struct AppCacheInfoCollection |
56 : public base::RefCountedThreadSafe<AppCacheInfoCollection> { | 34 : public base::RefCountedThreadSafe<AppCacheInfoCollection> { |
57 virtual ~AppCacheInfoCollection() {} | 35 virtual ~AppCacheInfoCollection() {} |
58 std::map<GURL, AppCacheInfoVector> infos_by_origin; | 36 std::map<GURL, AppCacheInfoVector> infos_by_origin; |
59 }; | 37 }; |
60 | 38 |
61 // Class that manages the application cache service. Sends notifications | 39 // Class that manages the application cache service. Sends notifications |
62 // to many frontends. One instance per user-profile. Each instance has | 40 // to many frontends. One instance per user-profile. Each instance has |
63 // exclusive access to it's cache_directory on disk. | 41 // exclusive access to it's cache_directory on disk. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 URLRequestContext* request_context_; | 118 URLRequestContext* request_context_; |
141 | 119 |
142 // TODO(jennb): service state: e.g. reached quota? | 120 // TODO(jennb): service state: e.g. reached quota? |
143 | 121 |
144 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 122 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
145 }; | 123 }; |
146 | 124 |
147 } // namespace appcache | 125 } // namespace appcache |
148 | 126 |
149 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 127 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
OLD | NEW |