Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: content/child/service_worker/web_service_worker_impl.h

Issue 261533003: Populate .current when navigator.serviceWorker is accessed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 13 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
14 #include "third_party/WebKit/public/platform/WebServiceWorker.h" 14 #include "third_party/WebKit/public/platform/WebServiceWorker.h"
15 #include "third_party/WebKit/public/web/WebFrame.h" 15 #include "third_party/WebKit/public/web/WebFrame.h"
16 16
17 namespace blink { 17 namespace blink {
18 class WebServiceWorkerProxy; 18 class WebServiceWorkerProxy;
19 } 19 }
20 20
21 namespace content { 21 namespace content {
22 22
23 class ScopedServiceWorkerReference;
24 struct ServiceWorkerObjectInfo;
23 class ThreadSafeSender; 25 class ThreadSafeSender;
24 struct ServiceWorkerObjectInfo;
25 26
26 class WebServiceWorkerImpl 27 class WebServiceWorkerImpl
michaeln 2014/05/01 01:25:18 similary a comment about how this corresponds to e
kinuko 2014/05/02 10:00:56 Done.
27 : NON_EXPORTED_BASE(public blink::WebServiceWorker) { 28 : NON_EXPORTED_BASE(public blink::WebServiceWorker) {
28 public: 29 public:
29 WebServiceWorkerImpl(const ServiceWorkerObjectInfo& info, 30 WebServiceWorkerImpl(const ServiceWorkerObjectInfo& info,
30 ThreadSafeSender* thread_safe_sender); 31 ThreadSafeSender* thread_safe_sender);
32 WebServiceWorkerImpl(scoped_ptr<ScopedServiceWorkerReference> worker_ref,
33 ThreadSafeSender* thread_safe_sender);
31 virtual ~WebServiceWorkerImpl(); 34 virtual ~WebServiceWorkerImpl();
32 35
33 // Notifies that the service worker's state changed. This function may queue 36 // Notifies that the service worker's state changed. This function may queue
34 // the state change for later processing, if the proxy is not yet ready to 37 // the state change for later processing, if the proxy is not yet ready to
35 // handle state changes. 38 // handle state changes.
36 void OnStateChanged(blink::WebServiceWorkerState new_state); 39 void OnStateChanged(blink::WebServiceWorkerState new_state);
37 40
38 virtual void setProxy(blink::WebServiceWorkerProxy* proxy); 41 virtual void setProxy(blink::WebServiceWorkerProxy* proxy);
39 virtual void proxyReadyChanged(); 42 virtual void proxyReadyChanged();
40 virtual blink::WebURL scope() const; 43 virtual blink::WebURL scope() const;
41 virtual blink::WebURL url() const; 44 virtual blink::WebURL url() const;
42 virtual blink::WebServiceWorkerState state() const; 45 virtual blink::WebServiceWorkerState state() const;
43 virtual void postMessage(const blink::WebString& message, 46 virtual void postMessage(const blink::WebString& message,
44 blink::WebMessagePortChannelArray* channels); 47 blink::WebMessagePortChannelArray* channels);
45 48
46 private: 49 private:
47 // Commits the new state internally and notifies the proxy of the change. 50 // Commits the new state internally and notifies the proxy of the change.
48 void ChangeState(blink::WebServiceWorkerState new_state); 51 void ChangeState(blink::WebServiceWorkerState new_state);
49 52
50 const int handle_id_; 53 scoped_ptr<ScopedServiceWorkerReference> worker_ref_;
51 const GURL scope_;
52 const GURL url_;
53 blink::WebServiceWorkerState state_; 54 blink::WebServiceWorkerState state_;
54 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 55 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
55 blink::WebServiceWorkerProxy* proxy_; 56 blink::WebServiceWorkerProxy* proxy_;
56 std::vector<blink::WebServiceWorkerState> queued_states_; 57 std::vector<blink::WebServiceWorkerState> queued_states_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerImpl); 59 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerImpl);
59 }; 60 };
60 61
61 } // namespace content 62 } // namespace content
62 63
63 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_ 64 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698