OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/sequence_checker.h" | 16 #include "base/sequence_checker.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "content/browser/service_worker/service_worker_version.h" | |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/service_worker/service_worker_status_code.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 namespace leveldb { | 22 namespace leveldb { |
22 class DB; | 23 class DB; |
23 class Env; | 24 class Env; |
24 class Status; | 25 class Status; |
25 class WriteBatch; | 26 class WriteBatch; |
26 } | 27 } |
27 | 28 |
28 namespace content { | 29 namespace content { |
(...skipping 16 matching lines...) Expand all Loading... |
45 GURL script; | 46 GURL script; |
46 | 47 |
47 // Versions are first stored once they successfully install and become | 48 // Versions are first stored once they successfully install and become |
48 // the waiting version. Then transition to the active version. The stored | 49 // the waiting version. Then transition to the active version. The stored |
49 // version may be in the ACTIVE state or in the INSTALLED state. | 50 // version may be in the ACTIVE state or in the INSTALLED state. |
50 int64 version_id; | 51 int64 version_id; |
51 bool is_active; | 52 bool is_active; |
52 bool has_fetch_handler; | 53 bool has_fetch_handler; |
53 base::Time last_update_check; | 54 base::Time last_update_check; |
54 | 55 |
55 ServiceWorkerVersion::Status GetVersionStatus() const { | |
56 if (is_active) | |
57 return ServiceWorkerVersion::ACTIVE; | |
58 return ServiceWorkerVersion::INSTALLED; | |
59 } | |
60 | |
61 RegistrationData(); | 56 RegistrationData(); |
62 ~RegistrationData(); | 57 ~RegistrationData(); |
63 }; | 58 }; |
64 | 59 |
65 struct ResourceRecord { | 60 struct ResourceRecord { |
66 int64 resource_id; | 61 int64 resource_id; |
67 GURL url; | 62 GURL url; |
68 }; | 63 }; |
69 | 64 |
70 // For use during initialization. | 65 // For use during initialization. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Basic); | 207 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Basic); |
213 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Overwrite); | 208 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Overwrite); |
214 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Multiple); | 209 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, Registration_Multiple); |
215 | 210 |
216 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); | 211 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); |
217 }; | 212 }; |
218 | 213 |
219 } // namespace content | 214 } // namespace content |
220 | 215 |
221 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ | 216 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ |
OLD | NEW |