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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 7 8 #include "base/memory/ref_counted.h" 9 10 namespace content { 11 12 class ServiceWorkerVersion; 13 14 // This class is the browser-process representation of a serice worker 15 // provider. There is a provider per document and the lifetime of this 16 // object is tied to the lifetime of its document in the renderer process. 17 // This class holds service worker state this is scoped to an individual 18 // document. 19 class ServiceWorkerProviderHost { 20 public: 21 ServiceWorkerProviderHost(int process_id, 22 int provider_id); 23 ~ServiceWorkerProviderHost(); 24 process_id()25 int process_id() const { return process_id_; } provider_id()26 int provider_id() const { return provider_id_; } 27 28 // The service worker version that corresponds with navigator.serviceWorker 29 // for our document. associated_version()30 ServiceWorkerVersion* associated_version() const { 31 return associated_version_.get(); 32 } 33 34 private: 35 const int process_id_; 36 const int provider_id_; 37 scoped_refptr<ServiceWorkerVersion> associated_version_; 38 }; 39 40 } // namespace content 41 42 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 43