| 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 class StoragePartition; | 26 class StoragePartition; |
| 27 class ServiceWorkerContextWrapper; | 27 class ServiceWorkerContextWrapper; |
| 28 class ServiceWorkerRegistration; | 28 class ServiceWorkerRegistration; |
| 29 class ServiceWorkerVersion; | 29 class ServiceWorkerVersion; |
| 30 | 30 |
| 31 class ServiceWorkerInternalsUI | 31 class ServiceWorkerInternalsUI |
| 32 : public WebUIController, | 32 : public WebUIController, |
| 33 public base::SupportsWeakPtr<ServiceWorkerInternalsUI> { | 33 public base::SupportsWeakPtr<ServiceWorkerInternalsUI> { |
| 34 public: | 34 public: |
| 35 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback; |
| 36 typedef void (ServiceWorkerVersion::*ServiceWorkerVersionMethod)( |
| 37 const StatusCallback& callback); |
| 38 |
| 35 explicit ServiceWorkerInternalsUI(WebUI* web_ui); | 39 explicit ServiceWorkerInternalsUI(WebUI* web_ui); |
| 36 | 40 |
| 37 private: | 41 private: |
| 38 class OperationProxy; | 42 class OperationProxy; |
| 39 class PartitionObserver; | 43 class PartitionObserver; |
| 40 | 44 |
| 41 virtual ~ServiceWorkerInternalsUI(); | 45 virtual ~ServiceWorkerInternalsUI(); |
| 42 void AddContextFromStoragePartition(StoragePartition* partition); | 46 void AddContextFromStoragePartition(StoragePartition* partition); |
| 43 | 47 |
| 44 void RemoveObserverFromStoragePartition(StoragePartition* partition); | 48 void RemoveObserverFromStoragePartition(StoragePartition* partition); |
| 45 | 49 |
| 46 // Called from Javascript. | 50 // Called from Javascript. |
| 47 void GetAllRegistrations(const base::ListValue* args); | 51 void GetAllRegistrations(const base::ListValue* args); |
| 48 void StartWorker(const base::ListValue* args); | 52 void CallServiceWorkerVersionMethod(ServiceWorkerVersionMethod method, |
| 49 void StopWorker(const base::ListValue* args); | 53 const base::ListValue* args); |
| 50 void DispatchSyncEventToWorker(const base::ListValue* args); | |
| 51 void InspectWorker(const base::ListValue* args); | 54 void InspectWorker(const base::ListValue* args); |
| 52 void Unregister(const base::ListValue* args); | 55 void Unregister(const base::ListValue* args); |
| 56 void StartWorker(const base::ListValue* args); |
| 53 | 57 |
| 54 bool GetRegistrationInfo( | 58 bool GetServiceWorkerContext( |
| 55 const base::ListValue* args, | 59 int partition_id, |
| 56 base::FilePath* partition_path, | |
| 57 GURL* scope, | |
| 58 scoped_refptr<ServiceWorkerContextWrapper>* context) const; | 60 scoped_refptr<ServiceWorkerContextWrapper>* context) const; |
| 61 void FindContext(int partition_id, |
| 62 StoragePartition** result_partition, |
| 63 StoragePartition* storage_partition) const; |
| 59 | 64 |
| 60 base::ScopedPtrHashMap<uintptr_t, PartitionObserver> observers_; | 65 base::ScopedPtrHashMap<uintptr_t, PartitionObserver> observers_; |
| 61 int next_partition_id_; | 66 int next_partition_id_; |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 } // namespace content | 69 } // namespace content |
| 65 | 70 |
| 66 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ | 71 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INTERNALS_UI_H_ |
| OLD | NEW |