| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h" | 11 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistration.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 class WebServiceWorker; | 14 class WebServiceWorker; |
| 15 class WebServiceWorkerRegistrationProxy; | 15 class WebServiceWorkerRegistrationProxy; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class ServiceWorkerRegistrationHandleReference; | 20 class ServiceWorkerRegistrationHandleReference; |
| 21 class ThreadSafeSender; | 21 class ThreadSafeSender; |
| 22 struct ServiceWorkerObjectInfo; | 22 struct ServiceWorkerObjectInfo; |
| 23 | 23 |
| 24 class WebServiceWorkerRegistrationImpl | 24 class WebServiceWorkerRegistrationImpl |
| 25 : NON_EXPORTED_BASE(public blink::WebServiceWorkerRegistration) { | 25 : NON_EXPORTED_BASE(public blink::WebServiceWorkerRegistration) { |
| 26 public: | 26 public: |
| 27 explicit WebServiceWorkerRegistrationImpl( | 27 using UnregisterCallbacks = |
| 28 blink::WebServiceWorkerRegistration::UnregisterCallbacks; |
| 29 |
| 30 WebServiceWorkerRegistrationImpl( |
| 31 int provider_id, |
| 28 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref); | 32 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref); |
| 29 virtual ~WebServiceWorkerRegistrationImpl(); | 33 virtual ~WebServiceWorkerRegistrationImpl(); |
| 30 | 34 |
| 31 void SetInstalling(blink::WebServiceWorker* service_worker); | 35 void SetInstalling(blink::WebServiceWorker* service_worker); |
| 32 void SetWaiting(blink::WebServiceWorker* service_worker); | 36 void SetWaiting(blink::WebServiceWorker* service_worker); |
| 33 void SetActive(blink::WebServiceWorker* service_worker); | 37 void SetActive(blink::WebServiceWorker* service_worker); |
| 34 | 38 |
| 35 void OnUpdateFound(); | 39 void OnUpdateFound(); |
| 36 | 40 |
| 37 // blink::WebServiceWorkerRegistration overrides. | 41 // blink::WebServiceWorkerRegistration overrides. |
| 38 virtual void setProxy(blink::WebServiceWorkerRegistrationProxy* proxy); | 42 virtual void setProxy(blink::WebServiceWorkerRegistrationProxy* proxy); |
| 39 virtual blink::WebServiceWorkerRegistrationProxy* proxy(); | 43 virtual blink::WebServiceWorkerRegistrationProxy* proxy(); |
| 40 virtual blink::WebURL scope() const; | 44 virtual blink::WebURL scope() const; |
| 45 virtual void unregister(UnregisterCallbacks*); |
| 41 | 46 |
| 42 int64 registration_id() const; | 47 int64 registration_id() const; |
| 43 | 48 |
| 44 private: | 49 private: |
| 45 enum QueuedTaskType { | 50 enum QueuedTaskType { |
| 46 INSTALLING, | 51 INSTALLING, |
| 47 WAITING, | 52 WAITING, |
| 48 ACTIVE, | 53 ACTIVE, |
| 49 UPDATE_FOUND, | 54 UPDATE_FOUND, |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 struct QueuedTask { | 57 struct QueuedTask { |
| 53 QueuedTask(QueuedTaskType type, | 58 QueuedTask(QueuedTaskType type, |
| 54 blink::WebServiceWorker* worker); | 59 blink::WebServiceWorker* worker); |
| 55 QueuedTaskType type; | 60 QueuedTaskType type; |
| 56 blink::WebServiceWorker* worker; | 61 blink::WebServiceWorker* worker; |
| 57 }; | 62 }; |
| 58 | 63 |
| 59 void RunQueuedTasks(); | 64 void RunQueuedTasks(); |
| 60 void ClearQueuedTasks(); | 65 void ClearQueuedTasks(); |
| 61 | 66 |
| 67 const int provider_id_; |
| 62 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref_; | 68 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref_; |
| 63 blink::WebServiceWorkerRegistrationProxy* proxy_; | 69 blink::WebServiceWorkerRegistrationProxy* proxy_; |
| 64 | 70 |
| 65 std::vector<QueuedTask> queued_tasks_; | 71 std::vector<QueuedTask> queued_tasks_; |
| 66 | 72 |
| 67 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerRegistrationImpl); | 73 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerRegistrationImpl); |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace content | 76 } // namespace content |
| 71 | 77 |
| 72 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ | 78 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_IMPL_H_ |
| OLD | NEW |