OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const StatusCallback& callback); | 198 const StatusCallback& callback); |
199 // Responds OK if all are successfully deleted or not found in the database. | 199 // Responds OK if all are successfully deleted or not found in the database. |
200 void ClearUserData(int64_t registration_id, | 200 void ClearUserData(int64_t registration_id, |
201 const std::vector<std::string>& keys, | 201 const std::vector<std::string>& keys, |
202 const StatusCallback& callback); | 202 const StatusCallback& callback); |
203 // Responds with all registrations that have user data with a particular key, | 203 // Responds with all registrations that have user data with a particular key, |
204 // as well as that user data. | 204 // as well as that user data. |
205 void GetUserDataForAllRegistrations( | 205 void GetUserDataForAllRegistrations( |
206 const std::string& key, | 206 const std::string& key, |
207 const GetUserDataForAllRegistrationsCallback& callback); | 207 const GetUserDataForAllRegistrationsCallback& callback); |
| 208 // Responds with all registrations that have user data with a particular key, |
| 209 // as well as that user data. |
| 210 void GetUserDataForAllRegistrationsByKeyPrefix( |
| 211 const std::string& key_prefix, |
| 212 const GetUserDataForAllRegistrationsCallback& callback); |
208 | 213 |
209 // Returns true if any service workers at |origin| have registered for foreign | 214 // Returns true if any service workers at |origin| have registered for foreign |
210 // fetch. | 215 // fetch. |
211 bool OriginHasForeignFetchRegistrations(const GURL& origin); | 216 bool OriginHasForeignFetchRegistrations(const GURL& origin); |
212 | 217 |
213 // Deletes the storage and starts over. | 218 // Deletes the storage and starts over. |
214 void DeleteAndStartOver(const StatusCallback& callback); | 219 void DeleteAndStartOver(const StatusCallback& callback); |
215 | 220 |
216 // Returns a new registration id which is guaranteed to be unique in the | 221 // Returns a new registration id which is guaranteed to be unique in the |
217 // storage. Returns kInvalidServiceWorkerRegistrationId if the storage is | 222 // storage. Returns kInvalidServiceWorkerRegistrationId if the storage is |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 ServiceWorkerDatabase* database, | 512 ServiceWorkerDatabase* database, |
508 scoped_refptr<base::SequencedTaskRunner> original_task_runner, | 513 scoped_refptr<base::SequencedTaskRunner> original_task_runner, |
509 int64_t registration_id, | 514 int64_t registration_id, |
510 const std::string& key_prefix, | 515 const std::string& key_prefix, |
511 const GetUserDataInDBCallback& callback); | 516 const GetUserDataInDBCallback& callback); |
512 static void GetUserDataForAllRegistrationsInDB( | 517 static void GetUserDataForAllRegistrationsInDB( |
513 ServiceWorkerDatabase* database, | 518 ServiceWorkerDatabase* database, |
514 scoped_refptr<base::SequencedTaskRunner> original_task_runner, | 519 scoped_refptr<base::SequencedTaskRunner> original_task_runner, |
515 const std::string& key, | 520 const std::string& key, |
516 const GetUserDataForAllRegistrationsInDBCallback& callback); | 521 const GetUserDataForAllRegistrationsInDBCallback& callback); |
| 522 static void GetUserDataForAllRegistrationsByKeyPrefixInDB( |
| 523 ServiceWorkerDatabase* database, |
| 524 scoped_refptr<base::SequencedTaskRunner> original_task_runner, |
| 525 const std::string& key_prefix, |
| 526 const GetUserDataForAllRegistrationsInDBCallback& callback); |
517 static void DeleteAllDataForOriginsFromDB( | 527 static void DeleteAllDataForOriginsFromDB( |
518 ServiceWorkerDatabase* database, | 528 ServiceWorkerDatabase* database, |
519 const std::set<GURL>& origins); | 529 const std::set<GURL>& origins); |
520 | 530 |
521 bool IsDisabled() const; | 531 bool IsDisabled() const; |
522 void ScheduleDeleteAndStartOver(); | 532 void ScheduleDeleteAndStartOver(); |
523 void DidDeleteDatabase( | 533 void DidDeleteDatabase( |
524 const StatusCallback& callback, | 534 const StatusCallback& callback, |
525 ServiceWorkerDatabase::Status status); | 535 ServiceWorkerDatabase::Status status); |
526 void DidDeleteDiskCache( | 536 void DidDeleteDiskCache( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 std::set<int64_t> pending_deletions_; | 581 std::set<int64_t> pending_deletions_; |
572 | 582 |
573 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 583 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
574 | 584 |
575 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 585 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
576 }; | 586 }; |
577 | 587 |
578 } // namespace content | 588 } // namespace content |
579 | 589 |
580 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 590 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |