| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_WATCHER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ServiceWorkerContextWatcher | 21 class ServiceWorkerContextWatcher |
| 22 : public ServiceWorkerContextObserver, | 22 : public ServiceWorkerContextObserver, |
| 23 public base::RefCountedThreadSafe<ServiceWorkerContextWatcher> { | 23 public base::RefCountedThreadSafe<ServiceWorkerContextWatcher> { |
| 24 public: | 24 public: |
| 25 typedef base::Callback<void( | 25 typedef base::Callback<void( |
| 26 const std::vector<ServiceWorkerRegistrationInfo>&)> | 26 const std::vector<ServiceWorkerRegistrationInfo>&)> |
| 27 WorkerRegistrationUpdatedCallback; | 27 WorkerRegistrationUpdatedCallback; |
| 28 typedef base::Callback<void(const std::vector<ServiceWorkerVersionInfo>&)> | 28 typedef base::Callback<void(const std::vector<ServiceWorkerVersionInfo>&)> |
| 29 WorkerVersionUpdatedCallback; | 29 WorkerVersionUpdatedCallback; |
| 30 typedef base::Callback<void(int64 /* registration_id */, | 30 typedef base::Callback<void(int64 /* registration_id */, |
| 31 int64 /* version_id */, | 31 std::string /* version_uuid */, |
| 32 const ErrorInfo&)> WorkerErrorReportedCallback; | 32 const ErrorInfo&)> WorkerErrorReportedCallback; |
| 33 | 33 |
| 34 ServiceWorkerContextWatcher( | 34 ServiceWorkerContextWatcher( |
| 35 scoped_refptr<ServiceWorkerContextWrapper> context, | 35 scoped_refptr<ServiceWorkerContextWrapper> context, |
| 36 const WorkerRegistrationUpdatedCallback& registration_callback, | 36 const WorkerRegistrationUpdatedCallback& registration_callback, |
| 37 const WorkerVersionUpdatedCallback& version_callback, | 37 const WorkerVersionUpdatedCallback& version_callback, |
| 38 const WorkerErrorReportedCallback& error_callback); | 38 const WorkerErrorReportedCallback& error_callback); |
| 39 void Start(); | 39 void Start(); |
| 40 void Stop(); | 40 void Stop(); |
| 41 | 41 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 void SendRegistrationInfo( | 57 void SendRegistrationInfo( |
| 58 int64 registration_id, | 58 int64 registration_id, |
| 59 const GURL& pattern, | 59 const GURL& pattern, |
| 60 ServiceWorkerRegistrationInfo::DeleteFlag delete_flag); | 60 ServiceWorkerRegistrationInfo::DeleteFlag delete_flag); |
| 61 void SendVersionInfo(const ServiceWorkerVersionInfo& version); | 61 void SendVersionInfo(const ServiceWorkerVersionInfo& version); |
| 62 | 62 |
| 63 // ServiceWorkerContextObserver implements | 63 // ServiceWorkerContextObserver implements |
| 64 void OnNewLiveRegistration(int64 registration_id, | 64 void OnNewLiveRegistration(int64 registration_id, |
| 65 const GURL& pattern) override; | 65 const GURL& pattern) override; |
| 66 void OnNewLiveVersion(int64 version_id, | 66 void OnNewLiveVersion(std::string version_uuid, |
| 67 int64 registration_id, | 67 int64 registration_id, |
| 68 const GURL& script_url) override; | 68 const GURL& script_url) override; |
| 69 void OnRunningStateChanged( | 69 void OnRunningStateChanged( |
| 70 int64 version_id, | 70 std::string version_uuid, |
| 71 content::ServiceWorkerVersion::RunningStatus running_status) override; | 71 content::ServiceWorkerVersion::RunningStatus running_status) override; |
| 72 void OnVersionStateChanged( | 72 void OnVersionStateChanged( |
| 73 int64 version_id, | 73 std::string version_uuid, |
| 74 content::ServiceWorkerVersion::Status status) override; | 74 content::ServiceWorkerVersion::Status status) override; |
| 75 void OnMainScriptHttpResponseInfoSet( | 75 void OnMainScriptHttpResponseInfoSet( |
| 76 int64 version_id, | 76 std::string version_uuid, |
| 77 base::Time script_response_time, | 77 base::Time script_response_time, |
| 78 base::Time script_last_modified) override; | 78 base::Time script_last_modified) override; |
| 79 void OnErrorReported(int64 version_id, | 79 void OnErrorReported(std::string version_uuid, |
| 80 int process_id, | 80 int process_id, |
| 81 int thread_id, | 81 int thread_id, |
| 82 const ErrorInfo& info) override; | 82 const ErrorInfo& info) override; |
| 83 void OnReportConsoleMessage(int64 version_id, | 83 void OnReportConsoleMessage(std::string version_uuid, |
| 84 int process_id, | 84 int process_id, |
| 85 int thread_id, | 85 int thread_id, |
| 86 const ConsoleMessage& message) override; | 86 const ConsoleMessage& message) override; |
| 87 void OnControlleeAdded(int64 version_id, | 87 void OnControlleeAdded(std::string version_uuid, |
| 88 const std::string& uuid, | 88 const std::string& uuid, |
| 89 int process_id, | 89 int process_id, |
| 90 int route_id, | 90 int route_id, |
| 91 ServiceWorkerProviderType type) override; | 91 ServiceWorkerProviderType type) override; |
| 92 void OnControlleeRemoved(int64 version_id, const std::string& uuid) override; | 92 void OnControlleeRemoved(std::string version_uuid, |
| 93 const std::string& uuid) override; |
| 93 void OnRegistrationStored(int64 registration_id, | 94 void OnRegistrationStored(int64 registration_id, |
| 94 const GURL& pattern) override; | 95 const GURL& pattern) override; |
| 95 void OnRegistrationDeleted(int64 registration_id, | 96 void OnRegistrationDeleted(int64 registration_id, |
| 96 const GURL& pattern) override; | 97 const GURL& pattern) override; |
| 97 | 98 |
| 98 base::ScopedPtrHashMap<int64, scoped_ptr<ServiceWorkerVersionInfo>> | 99 base::ScopedPtrHashMap<std::string, scoped_ptr<ServiceWorkerVersionInfo>> |
| 99 version_info_map_; | 100 version_info_map_; |
| 100 scoped_refptr<ServiceWorkerContextWrapper> context_; | 101 scoped_refptr<ServiceWorkerContextWrapper> context_; |
| 101 WorkerRegistrationUpdatedCallback registration_callback_; | 102 WorkerRegistrationUpdatedCallback registration_callback_; |
| 102 WorkerVersionUpdatedCallback version_callback_; | 103 WorkerVersionUpdatedCallback version_callback_; |
| 103 WorkerErrorReportedCallback error_callback_; | 104 WorkerErrorReportedCallback error_callback_; |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace content | 107 } // namespace content |
| 107 | 108 |
| 108 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ | 109 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WATCHER_H_ |
| OLD | NEW |