Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / common / background_sync_service.mojom
blobb4c9b935c66bb80631f2855b64f9bb24dcea64f2
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 module content;
7 import "content/public/common/background_sync.mojom";
8 import "content/public/common/permission_status.mojom";
9 import "content/public/common/service_worker_event_status.mojom";
11 enum BackgroundSyncError {
12   NONE,
13   STORAGE,
14   NOT_FOUND,
15   NO_SERVICE_WORKER,
16   NOT_ALLOWED,
17   MAX=NOT_ALLOWED
20 enum BackgroundSyncState {
21   PENDING,
22   FIRING,
23   UNREGISTERED_WHILE_FIRING,
24   FAILED,
25   SUCCESS,
26   UNREGISTERED
27  };
29 interface BackgroundSyncService {
30   Register(SyncRegistration options, int64 service_worker_registration_id,
31            bool requested_from_service_worker)
32       => (BackgroundSyncError err, SyncRegistration options);
33   GetRegistration(BackgroundSyncPeriodicity periodicity, string tag,
34                   int64 service_worker_registration_id)
35       => (BackgroundSyncError err, SyncRegistration? registration);
36   GetRegistrations(BackgroundSyncPeriodicity periodicity,
37                    int64 service_worker_registration_id)
38       => (BackgroundSyncError err, array<SyncRegistration> registrations);
39   Unregister(BackgroundSyncPeriodicity periodicity, int32 handle_id,
40              int64 service_worker_registration_id) => (BackgroundSyncError err);
41   GetPermissionStatus(BackgroundSyncPeriodicity periodicity,
42                       int64 service_worker_registration_id)
43       => (BackgroundSyncError err, PermissionStatus status);
44   DuplicateRegistrationHandle(int32 handle_id) 
45       => (BackgroundSyncError err, SyncRegistration? registration);  
46   ReleaseRegistration(int32 handle_id);
47   NotifyWhenDone(int32 handle_id) => (BackgroundSyncError err, BackgroundSyncState final_status);
50 interface BackgroundSyncServiceClient {
51   Sync(int32 handle_id)
52       => (ServiceWorkerEventStatus status);