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_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENCE_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENCE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
14 class ThreadSafeSender;
15 struct ServiceWorkerObjectInfo;
17 class ServiceWorkerRegistrationHandleReference {
19 // Creates a new ServiceWorkerRegistrationHandleReference and increments
21 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Create(
22 int registration_handle_id,
23 const ServiceWorkerObjectInfo& info,
24 ThreadSafeSender* sender);
26 // Creates a new ServiceWorkerRegistrationHandleReference by adopting a
28 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Adopt(
29 int registration_handle_id,
30 const ServiceWorkerObjectInfo& info,
31 ThreadSafeSender* sender);
33 ~ServiceWorkerRegistrationHandleReference();
35 int handle_id() const { return handle_id_; }
36 GURL scope() const { return scope_; }
39 ServiceWorkerRegistrationHandleReference(int registration_handle_id,
40 const ServiceWorkerObjectInfo& info,
41 ThreadSafeSender* sender,
42 bool increment_ref_in_ctor);
46 scoped_refptr<ThreadSafeSender> sender_;
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandleReference);
51 } // namespace content
53 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENCE_H_