Home | History | Annotate | Download | only in service_worker
      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.
      4 
      5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_
      6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_
      7 
      8 namespace content {
      9 
     10 class ServiceWorkerRegisterJobBase {
     11  public:
     12   enum RegistrationJobType {
     13     REGISTRATION_JOB,
     14     UNREGISTRATION_JOB,
     15     UPDATE_JOB
     16   };
     17 
     18   virtual ~ServiceWorkerRegisterJobBase() {}
     19 
     20   // Starts the job. This method should be called once and only once per job.
     21   virtual void Start() = 0;
     22 
     23   // Aborts the job. This method should be called once and only once per job.
     24   // It can be called regardless of whether Start() was called.
     25   virtual void Abort() = 0;
     26 
     27   // Returns true if this job is identical to |job| for the purpose of
     28   // collapsing them together in a ServiceWorkerJobCoordinator queue.
     29   // Registration jobs are equal if they are for the same pattern and script
     30   // URL; unregistration jobs are equal if they are for the same pattern.
     31   virtual bool Equals(ServiceWorkerRegisterJobBase* job) = 0;
     32 
     33   // Returns the type of this job.
     34   virtual RegistrationJobType GetType() = 0;
     35 };
     36 
     37 }  // namespace content
     38 
     39 #endif  // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_
     40