| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_IMPL_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ThreadSafeSender; | 21 class ThreadSafeSender; |
| 22 struct ServiceWorkerObjectInfo; | 22 struct ServiceWorkerObjectInfo; |
| 23 | 23 |
| 24 class WebServiceWorkerImpl | 24 class WebServiceWorkerImpl |
| 25 : NON_EXPORTED_BASE(public blink::WebServiceWorker) { | 25 : NON_EXPORTED_BASE(public blink::WebServiceWorker) { |
| 26 public: | 26 public: |
| 27 WebServiceWorkerImpl(const ServiceWorkerObjectInfo& info, | 27 WebServiceWorkerImpl(const ServiceWorkerObjectInfo& info, |
| 28 ThreadSafeSender* thread_safe_sender); | 28 ThreadSafeSender* thread_safe_sender); |
| 29 virtual ~WebServiceWorkerImpl(); | 29 virtual ~WebServiceWorkerImpl(); |
| 30 | 30 |
| 31 void SetState(blink::WebServiceWorkerState new_state); | |
| 32 | |
| 33 virtual void setProxy(blink::WebServiceWorkerProxy* proxy); | 31 virtual void setProxy(blink::WebServiceWorkerProxy* proxy); |
| 32 virtual void setState(blink::WebServiceWorkerState new_state); |
| 34 virtual blink::WebURL scope() const; | 33 virtual blink::WebURL scope() const; |
| 35 virtual blink::WebURL url() const; | 34 virtual blink::WebURL url() const; |
| 36 virtual blink::WebServiceWorkerState state() const; | 35 virtual blink::WebServiceWorkerState state() const; |
| 37 virtual void postMessage(const blink::WebString& message, | 36 virtual void postMessage(const blink::WebString& message, |
| 38 blink::WebMessagePortChannelArray* channels); | 37 blink::WebMessagePortChannelArray* channels); |
| 39 | 38 |
| 39 // Informs the proxy that the state changed on the browser side. The proxy may |
| 40 // queue the change and call setState() to commit it when ready. |
| 41 void OnStateChanged(blink::WebServiceWorkerState new_state); |
| 42 |
| 40 private: | 43 private: |
| 41 const int handle_id_; | 44 const int handle_id_; |
| 42 const GURL scope_; | 45 const GURL scope_; |
| 43 const GURL url_; | 46 const GURL url_; |
| 44 blink::WebServiceWorkerState state_; | 47 blink::WebServiceWorkerState state_; |
| 45 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 48 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 46 blink::WebServiceWorkerProxy* proxy_; | 49 blink::WebServiceWorkerProxy* proxy_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerImpl); | 51 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerImpl); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace content | 54 } // namespace content |
| 52 | 55 |
| 53 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ | 56 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ |
| OLD | NEW |