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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "content/browser/service_worker/service_worker_context_observer.h"
16 #include "content/common/service_worker/service_worker_status_code.h"
17 #include "content/public/browser/web_ui_controller.h"
21 class DictionaryValue
;
26 class StoragePartition
;
27 class ServiceWorkerContextWrapper
;
28 class ServiceWorkerRegistration
;
29 class ServiceWorkerVersion
;
31 class ServiceWorkerInternalsUI
32 : public WebUIController
,
33 public base::SupportsWeakPtr
<ServiceWorkerInternalsUI
> {
35 explicit ServiceWorkerInternalsUI(WebUI
* web_ui
);
39 class PartitionObserver
;
41 virtual ~ServiceWorkerInternalsUI();
42 void AddContextFromStoragePartition(StoragePartition
* partition
);
44 void RemoveObserverFromStoragePartition(StoragePartition
* partition
);
46 // Called from Javascript.
47 void GetAllRegistrations(const base::ListValue
* args
);
48 void StartWorker(const base::ListValue
* args
);
49 void StopWorker(const base::ListValue
* args
);
50 void DispatchSyncEventToWorker(const base::ListValue
* args
);
51 void Unregister(const base::ListValue
* args
);
53 bool GetRegistrationInfo(
54 const base::ListValue
* args
,
55 base::FilePath
* partition_path
,
57 scoped_refptr
<ServiceWorkerContextWrapper
>* context
) const;
59 base::ScopedPtrHashMap
<uintptr_t, PartitionObserver
> observers_
;
60 int next_partition_id_
;
63 } // namespace content
65 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_