Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / child / service_worker / service_worker_registration_handle_reference.h
blobc7138e622c9f30598bb1e6fec96f17846e06fa4e
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"
10 #include "content/common/service_worker/service_worker_types.h"
11 #include "url/gurl.h"
13 namespace content {
15 class ThreadSafeSender;
17 class ServiceWorkerRegistrationHandleReference {
18 public:
19 // Creates a new ServiceWorkerRegistrationHandleReference and increments
20 // ref-count.
21 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Create(
22 const ServiceWorkerRegistrationObjectInfo& info,
23 ThreadSafeSender* sender);
25 // Creates a new ServiceWorkerRegistrationHandleReference by adopting a
26 // ref-count.
27 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Adopt(
28 const ServiceWorkerRegistrationObjectInfo& info,
29 ThreadSafeSender* sender);
31 ~ServiceWorkerRegistrationHandleReference();
33 const ServiceWorkerRegistrationObjectInfo& info() const { return info_; }
34 int handle_id() const { return info_.handle_id; }
35 GURL scope() const { return info_.scope; }
36 int64 registration_id() const { return info_.registration_id; }
38 private:
39 ServiceWorkerRegistrationHandleReference(
40 const ServiceWorkerRegistrationObjectInfo& info,
41 ThreadSafeSender* sender,
42 bool increment_ref_in_ctor);
44 ServiceWorkerRegistrationObjectInfo info_;
45 scoped_refptr<ThreadSafeSender> sender_;
47 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandleReference);
50 } // namespace content
52 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENCE_H_