| 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 <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 // Sends a message event to the associated embedded worker. | 169 // Sends a message event to the associated embedded worker. |
| 170 void DispatchMessageEvent( | 170 void DispatchMessageEvent( |
| 171 const base::string16& message, | 171 const base::string16& message, |
| 172 const std::vector<TransferredMessagePort>& sent_message_ports, | 172 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 173 const StatusCallback& callback); | 173 const StatusCallback& callback); |
| 174 | 174 |
| 175 // Sends install event to the associated embedded worker and asynchronously | 175 // Sends install event to the associated embedded worker and asynchronously |
| 176 // calls |callback| when it errors out or it gets a response from the worker | 176 // calls |callback| when it errors out or it gets a response from the worker |
| 177 // to notify install completion. | 177 // to notify install completion. |
| 178 // |active_version_id| must be a valid positive ID | |
| 179 // if there's an activated (previous) version running. | |
| 180 // | 178 // |
| 181 // This must be called when the status() is NEW. Calling this changes | 179 // This must be called when the status() is NEW. Calling this changes |
| 182 // the version's status to INSTALLING. | 180 // the version's status to INSTALLING. |
| 183 // Upon completion, the version's status will be changed to INSTALLED | 181 // Upon completion, the version's status will be changed to INSTALLED |
| 184 // on success, or back to NEW on failure. | 182 // on success, or back to NEW on failure. |
| 185 void DispatchInstallEvent(int active_version_id, | 183 void DispatchInstallEvent(const StatusCallback& callback); |
| 186 const StatusCallback& callback); | |
| 187 | 184 |
| 188 // Sends activate event to the associated embedded worker and asynchronously | 185 // Sends activate event to the associated embedded worker and asynchronously |
| 189 // calls |callback| when it errors out or it gets a response from the worker | 186 // calls |callback| when it errors out or it gets a response from the worker |
| 190 // to notify activation completion. | 187 // to notify activation completion. |
| 191 // | 188 // |
| 192 // This must be called when the status() is INSTALLED. Calling this changes | 189 // This must be called when the status() is INSTALLED. Calling this changes |
| 193 // the version's status to ACTIVATING. | 190 // the version's status to ACTIVATING. |
| 194 // Upon completion, the version's status will be changed to ACTIVATED | 191 // Upon completion, the version's status will be changed to ACTIVATED |
| 195 // on success, or back to INSTALLED on failure. | 192 // on success, or back to INSTALLED on failure. |
| 196 void DispatchActivateEvent(const StatusCallback& callback); | 193 void DispatchActivateEvent(const StatusCallback& callback); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 const GURL& source_url) override; | 331 const GURL& source_url) override; |
| 335 void OnReportConsoleMessage(int source_identifier, | 332 void OnReportConsoleMessage(int source_identifier, |
| 336 int message_level, | 333 int message_level, |
| 337 const base::string16& message, | 334 const base::string16& message, |
| 338 int line_number, | 335 int line_number, |
| 339 const GURL& source_url) override; | 336 const GURL& source_url) override; |
| 340 bool OnMessageReceived(const IPC::Message& message) override; | 337 bool OnMessageReceived(const IPC::Message& message) override; |
| 341 | 338 |
| 342 void OnStartMessageSent(ServiceWorkerStatusCode status); | 339 void OnStartMessageSent(ServiceWorkerStatusCode status); |
| 343 | 340 |
| 344 void DispatchInstallEventAfterStartWorker(int active_version_id, | 341 void DispatchInstallEventAfterStartWorker(const StatusCallback& callback); |
| 345 const StatusCallback& callback); | |
| 346 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); | 342 void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); |
| 347 | 343 |
| 348 void DispatchMessageEventInternal( | 344 void DispatchMessageEventInternal( |
| 349 const base::string16& message, | 345 const base::string16& message, |
| 350 const std::vector<TransferredMessagePort>& sent_message_ports, | 346 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 351 const StatusCallback& callback); | 347 const StatusCallback& callback); |
| 352 | 348 |
| 353 // Message handlers. | 349 // Message handlers. |
| 354 void OnGetClientDocuments(int request_id); | 350 void OnGetClientDocuments(int request_id); |
| 355 void OnActivateEventFinished(int request_id, | 351 void OnActivateEventFinished(int request_id, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 456 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
| 461 | 457 |
| 462 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 458 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 463 | 459 |
| 464 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 460 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 465 }; | 461 }; |
| 466 | 462 |
| 467 } // namespace content | 463 } // namespace content |
| 468 | 464 |
| 469 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 465 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |