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_CONTEXT_OBSERVER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_OBSERVER_H_
8 #include "base/strings/string16.h"
13 class ServiceWorkerContextObserver
{
16 ErrorInfo(const base::string16
& message
,
20 : error_message(message
),
22 column_number(column
),
24 const base::string16 error_message
;
25 const int line_number
;
26 const int column_number
;
27 const GURL source_url
;
29 struct ConsoleMessage
{
30 ConsoleMessage(int source_identifier
,
32 const base::string16
& message
,
34 const GURL
& source_url
)
35 : source_identifier(source_identifier
),
36 message_level(message_level
),
38 line_number(line_number
),
39 source_url(source_url
) {}
40 const int source_identifier
;
41 const int message_level
;
42 const base::string16 message
;
43 const int line_number
;
44 const GURL source_url
;
46 virtual void OnWorkerStarted(int64 version_id
,
49 virtual void OnWorkerStopped(int64 version_id
,
52 virtual void OnVersionStateChanged(int64 version_id
) {}
53 virtual void OnErrorReported(int64 version_id
,
56 const ErrorInfo
& info
) {}
57 virtual void OnReportConsoleMessage(int64 version_id
,
60 const ConsoleMessage
& message
) {}
61 virtual void OnRegistrationStored(const GURL
& pattern
) {}
62 virtual void OnRegistrationDeleted(int64 registration_id
,
63 const GURL
& pattern
) {}
65 // Notified when the storage corruption recovery is completed and all stored
67 virtual void OnStorageWiped() {}
70 virtual ~ServiceWorkerContextObserver() {}
73 } // namespace content
75 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_OBSERVER_H_