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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_
10 // A base class for ServiceWorkerRegisterJob and ServiceWorkerUnregisterJob. A
11 // job lives only for the lifetime of a single registration or unregistration.
12 class ServiceWorkerRegisterJobBase
{
14 enum RegistrationJobType
{ REGISTRATION
, UNREGISTRATION
, };
16 virtual ~ServiceWorkerRegisterJobBase() {}
18 // Starts the job. This method should be called once and only once per job.
19 virtual void Start() = 0;
21 // Returns true if this job is identical to |job| for the purpose of
22 // collapsing them together in a ServiceWorkerJobCoordinator queue.
23 // Registration jobs are equal if they are for the same pattern and script
24 // URL; unregistration jobs are equal if they are for the same pattern.
25 virtual bool Equals(ServiceWorkerRegisterJobBase
* job
) = 0;
27 // Returns the type of this job.
28 virtual RegistrationJobType
GetType() = 0;
31 } // namespace content
33 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_