1e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch// found in the LICENSE file. 4e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 5e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ 6e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ 7e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 8e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdochnamespace content { 9e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 10e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdochclass ServiceWorkerRegisterJobBase { 11e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch public: 125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) enum RegistrationJobType { 135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) REGISTRATION_JOB, 145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) UNREGISTRATION_JOB, 155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) UPDATE_JOB 165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) }; 17e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 18e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch virtual ~ServiceWorkerRegisterJobBase() {} 19e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 20e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Starts the job. This method should be called once and only once per job. 21e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch virtual void Start() = 0; 22e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 236d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) // Aborts the job. This method should be called once and only once per job. 246d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) // It can be called regardless of whether Start() was called. 256d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) virtual void Abort() = 0; 266d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 27e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Returns true if this job is identical to |job| for the purpose of 28e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // collapsing them together in a ServiceWorkerJobCoordinator queue. 29e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Registration jobs are equal if they are for the same pattern and script 30e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // URL; unregistration jobs are equal if they are for the same pattern. 31e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch virtual bool Equals(ServiceWorkerRegisterJobBase* job) = 0; 32e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 33e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Returns the type of this job. 34e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch virtual RegistrationJobType GetType() = 0; 35e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch}; 36e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 37e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch} // namespace content 38e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 39e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ 40