Chromium Code Reviews| 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/service_worker/service_worker_context_core.h" | 11 #include "content/browser/service_worker/service_worker_context_core.h" |
| 12 #include "content/browser/service_worker/service_worker_context_observer.h" | |
| 12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/service_worker_context.h" | 14 #include "content/public/browser/service_worker_context.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class FilePath; | 17 class FilePath; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace quota { | 20 namespace quota { |
| 20 class QuotaManagerProxy; | 21 class QuotaManagerProxy; |
| 21 } | 22 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 48 const GURL& script_url, | 49 const GURL& script_url, |
| 49 int source_process_id, | 50 int source_process_id, |
| 50 const ResultCallback& continuation) | 51 const ResultCallback& continuation) |
| 51 OVERRIDE; | 52 OVERRIDE; |
| 52 | 53 |
| 53 virtual void UnregisterServiceWorker(const GURL& pattern, | 54 virtual void UnregisterServiceWorker(const GURL& pattern, |
| 54 int source_process_id, | 55 int source_process_id, |
| 55 const ResultCallback& continuation) | 56 const ResultCallback& continuation) |
| 56 OVERRIDE; | 57 OVERRIDE; |
| 57 | 58 |
| 59 virtual scoped_ptr<base::CallbackList<void(void)>::Subscription> | |
|
michaeln
2014/04/25 22:09:14
From callback_list.h
// Add a callback to the l
horo
2014/04/26 08:00:45
Done.
Oh, I didn't understand that. Thank you.
| |
| 60 RegisterStatusChangeCallback( | |
| 61 const base::Callback<void(void)>& callback) OVERRIDE; | |
| 62 | |
| 63 virtual void GetRunningServiceWorkerInfo( | |
| 64 const GetRunningServiceWorkerInfoCallback& callback) OVERRIDE; | |
| 65 | |
| 58 void AddObserver(ServiceWorkerContextObserver* observer); | 66 void AddObserver(ServiceWorkerContextObserver* observer); |
| 59 void RemoveObserver(ServiceWorkerContextObserver* observer); | 67 void RemoveObserver(ServiceWorkerContextObserver* observer); |
| 60 | 68 |
| 61 private: | 69 private: |
| 62 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 70 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 63 virtual ~ServiceWorkerContextWrapper(); | 71 virtual ~ServiceWorkerContextWrapper(); |
| 64 | 72 |
| 73 class CallbackProxy : public ServiceWorkerContextObserver, | |
|
michaeln
2014/04/25 22:09:14
Alternatively, it looks like ServiceWorkerContextW
horo
2014/04/26 08:00:45
Done.
| |
| 74 public base::RefCountedThreadSafe<CallbackProxy> { | |
| 75 public: | |
| 76 CallbackProxy() {} | |
| 77 virtual ~CallbackProxy() {} | |
| 78 scoped_ptr<base::CallbackList<void(void)>::Subscription> Add( | |
| 79 const base::Callback<void(void)>& callback); | |
| 80 virtual void OnWorkerStarted(int64 version_id, | |
| 81 int process_id, | |
| 82 int thread_id); | |
| 83 virtual void OnWorkerStopped(int64 version_id, | |
| 84 int process_id, | |
| 85 int thread_id); | |
| 86 virtual void OnVersionStateChanged(int64 version_id); | |
| 87 | |
| 88 private: | |
| 89 void onStatusChanged(); | |
| 90 base::CallbackList<void(void)> status_change_callback_list_; | |
| 91 }; | |
| 92 | |
| 93 void onStatusChanged(); | |
|
michaeln
2014/04/25 22:09:14
is this used?
| |
| 94 | |
| 65 scoped_ptr<ServiceWorkerContextCore> context_core_; | 95 scoped_ptr<ServiceWorkerContextCore> context_core_; |
| 66 scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > | 96 scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > |
| 67 observer_list_; | 97 observer_list_; |
| 98 scoped_refptr<CallbackProxy> callback_proxy_; | |
| 68 }; | 99 }; |
| 69 | 100 |
| 70 } // namespace content | 101 } // namespace content |
| 71 | 102 |
| 72 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 103 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |