Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / child / service_worker / web_service_worker_registration_impl.h
blob67ecc1a5393a2ea8f80ae45a94a37926ec16751d
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_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h"
14 namespace blink {
15 class WebServiceWorker;
16 class WebServiceWorkerRegistrationProxy;
19 namespace content {
21 class ServiceWorkerRegistrationHandleReference;
22 class ThreadSafeSender;
23 struct ServiceWorkerObjectInfo;
25 class CONTENT_EXPORT WebServiceWorkerRegistrationImpl
26 : NON_EXPORTED_BASE(public blink::WebServiceWorkerRegistration) {
27 public:
28 explicit WebServiceWorkerRegistrationImpl(
29 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref);
30 virtual ~WebServiceWorkerRegistrationImpl();
32 void SetInstalling(blink::WebServiceWorker* service_worker);
33 void SetWaiting(blink::WebServiceWorker* service_worker);
34 void SetActive(blink::WebServiceWorker* service_worker);
36 void OnUpdateFound();
38 // blink::WebServiceWorkerRegistration overrides.
39 virtual void setProxy(blink::WebServiceWorkerRegistrationProxy* proxy);
40 virtual blink::WebServiceWorkerRegistrationProxy* proxy();
41 virtual blink::WebURL scope() const;
42 virtual void update(blink::WebServiceWorkerProvider* provider);
43 virtual void unregister(blink::WebServiceWorkerProvider* provider,
44 WebServiceWorkerUnregistrationCallbacks* callbacks);
46 int64 registration_id() const;
48 private:
49 enum QueuedTaskType {
50 INSTALLING,
51 WAITING,
52 ACTIVE,
53 UPDATE_FOUND,
56 struct QueuedTask {
57 QueuedTask(QueuedTaskType type,
58 blink::WebServiceWorker* worker);
59 QueuedTaskType type;
60 blink::WebServiceWorker* worker;
63 void RunQueuedTasks();
64 void ClearQueuedTasks();
66 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref_;
67 blink::WebServiceWorkerRegistrationProxy* proxy_;
69 std::vector<QueuedTask> queued_tasks_;
71 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerRegistrationImpl);
74 } // namespace content
76 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_