| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_OBSERVER_H_ | |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_OBSERVER_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "base/time/time.h" | |
| 13 #include "content/browser/service_worker/service_worker_info.h" | |
| 14 #include "content/browser/service_worker/service_worker_version.h" | |
| 15 #include "url/gurl.h" | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 enum class EmbeddedWorkerStatus; | |
| 20 | |
| 21 class ServiceWorkerContextObserver { | |
| 22 public: | |
| 23 struct ErrorInfo { | |
| 24 ErrorInfo(const base::string16& message, | |
| 25 int line, | |
| 26 int column, | |
| 27 const GURL& url) | |
| 28 : error_message(message), | |
| 29 line_number(line), | |
| 30 column_number(column), | |
| 31 source_url(url) {} | |
| 32 const base::string16 error_message; | |
| 33 const int line_number; | |
| 34 const int column_number; | |
| 35 const GURL source_url; | |
| 36 }; | |
| 37 struct ConsoleMessage { | |
| 38 ConsoleMessage(int source_identifier, | |
| 39 int message_level, | |
| 40 const base::string16& message, | |
| 41 int line_number, | |
| 42 const GURL& source_url) | |
| 43 : source_identifier(source_identifier), | |
| 44 message_level(message_level), | |
| 45 message(message), | |
| 46 line_number(line_number), | |
| 47 source_url(source_url) {} | |
| 48 const int source_identifier; | |
| 49 const int message_level; | |
| 50 const base::string16 message; | |
| 51 const int line_number; | |
| 52 const GURL source_url; | |
| 53 }; | |
| 54 virtual void OnNewLiveRegistration(int64_t registration_id, | |
| 55 const GURL& pattern) {} | |
| 56 virtual void OnNewLiveVersion(const ServiceWorkerVersionInfo& version_info) {} | |
| 57 virtual void OnRunningStateChanged(int64_t version_id, | |
| 58 EmbeddedWorkerStatus running_status) {} | |
| 59 virtual void OnVersionStateChanged(int64_t version_id, | |
| 60 ServiceWorkerVersion::Status status) {} | |
| 61 virtual void OnVersionDevToolsRoutingIdChanged(int64_t version_id, | |
| 62 int process_id, | |
| 63 int devtools_agent_route_id) {} | |
| 64 virtual void OnMainScriptHttpResponseInfoSet( | |
| 65 int64_t version_id, | |
| 66 base::Time script_response_time, | |
| 67 base::Time script_last_modified) {} | |
| 68 virtual void OnErrorReported(int64_t version_id, | |
| 69 int process_id, | |
| 70 int thread_id, | |
| 71 const ErrorInfo& info) {} | |
| 72 virtual void OnReportConsoleMessage(int64_t version_id, | |
| 73 int process_id, | |
| 74 int thread_id, | |
| 75 const ConsoleMessage& message) {} | |
| 76 // |web_contents_getter| is only set in PlzNavigate. | |
| 77 virtual void OnControlleeAdded( | |
| 78 int64_t version_id, | |
| 79 const std::string& uuid, | |
| 80 int process_id, | |
| 81 int route_id, | |
| 82 const base::Callback<WebContents*(void)>& web_contents_getter, | |
| 83 ServiceWorkerProviderType type) {} | |
| 84 virtual void OnControlleeRemoved(int64_t version_id, | |
| 85 const std::string& uuid) {} | |
| 86 virtual void OnRegistrationStored(int64_t registration_id, | |
| 87 const GURL& pattern) {} | |
| 88 virtual void OnRegistrationDeleted(int64_t registration_id, | |
| 89 const GURL& pattern) {} | |
| 90 | |
| 91 // Notified when the storage corruption recovery is completed and all stored | |
| 92 // data is wiped out. | |
| 93 virtual void OnStorageWiped() {} | |
| 94 | |
| 95 protected: | |
| 96 virtual ~ServiceWorkerContextObserver() {} | |
| 97 }; | |
| 98 | |
| 99 } // namespace content | |
| 100 | |
| 101 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_OBSERVER_H_ | |
| OLD | NEW |