| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/id_map.h" | 15 #include "base/id_map.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 INSTALLING, // Install event is dispatched and being handled. | 64 INSTALLING, // Install event is dispatched and being handled. |
| 64 INSTALLED, // Install event is finished and is ready to be activated. | 65 INSTALLED, // Install event is finished and is ready to be activated. |
| 65 ACTIVATING, // Activate event is dispatched and being handled. | 66 ACTIVATING, // Activate event is dispatched and being handled. |
| 66 ACTIVATED, // Activation is finished and can run as activated. | 67 ACTIVATED, // Activation is finished and can run as activated. |
| 67 REDUNDANT, // The version is no longer running as activated, due to | 68 REDUNDANT, // The version is no longer running as activated, due to |
| 68 // unregistration or replace. | 69 // unregistration or replace. |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 class Listener { | 72 class Listener { |
| 72 public: | 73 public: |
| 73 virtual void OnWorkerStarted(ServiceWorkerVersion* version) {}; | 74 virtual void OnWorkerStarted(ServiceWorkerVersion* version) {} |
| 74 virtual void OnWorkerStopped(ServiceWorkerVersion* version) {}; | 75 virtual void OnWorkerStopped(ServiceWorkerVersion* version) {} |
| 75 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {}; | 76 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {} |
| 76 virtual void OnErrorReported(ServiceWorkerVersion* version, | 77 virtual void OnErrorReported(ServiceWorkerVersion* version, |
| 77 const base::string16& error_message, | 78 const base::string16& error_message, |
| 78 int line_number, | 79 int line_number, |
| 79 int column_number, | 80 int column_number, |
| 80 const GURL& source_url) {}; | 81 const GURL& source_url) {} |
| 81 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, | 82 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, |
| 82 int source_identifier, | 83 int source_identifier, |
| 83 int message_level, | 84 int message_level, |
| 84 const base::string16& message, | 85 const base::string16& message, |
| 85 int line_number, | 86 int line_number, |
| 86 const GURL& source_url) {}; | 87 const GURL& source_url) {} |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 ServiceWorkerVersion( | 90 ServiceWorkerVersion( |
| 90 ServiceWorkerRegistration* registration, | 91 ServiceWorkerRegistration* registration, |
| 91 int64 version_id, | 92 int64 version_id, |
| 92 base::WeakPtr<ServiceWorkerContextCore> context); | 93 base::WeakPtr<ServiceWorkerContextCore> context); |
| 93 | 94 |
| 94 int64 version_id() const { return version_id_; } | 95 int64 version_id() const { return version_id_; } |
| 95 int64 registration_id() const { return registration_id_; } | 96 int64 registration_id() const { return registration_id_; } |
| 96 const GURL& script_url() const { return script_url_; } | 97 const GURL& script_url() const { return script_url_; } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 bool is_doomed_; | 296 bool is_doomed_; |
| 296 | 297 |
| 297 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 298 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 298 | 299 |
| 299 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 300 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 300 }; | 301 }; |
| 301 | 302 |
| 302 } // namespace content | 303 } // namespace content |
| 303 | 304 |
| 304 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 305 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |