| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 ServiceWorkerVersionInfo GetInfo(); | 142 ServiceWorkerVersionInfo GetInfo(); |
| 143 Status status() const { return status_; } | 143 Status status() const { return status_; } |
| 144 | 144 |
| 145 const std::vector<GURL>& foreign_fetch_scopes() const { | 145 const std::vector<GURL>& foreign_fetch_scopes() const { |
| 146 return foreign_fetch_scopes_; | 146 return foreign_fetch_scopes_; |
| 147 } | 147 } |
| 148 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { | 148 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { |
| 149 foreign_fetch_scopes_ = scopes; | 149 foreign_fetch_scopes_ = scopes; |
| 150 } | 150 } |
| 151 | 151 |
| 152 const std::vector<GURL>& foreign_fetch_origins() const { |
| 153 return foreign_fetch_origins_; |
| 154 } |
| 155 void set_foreign_fetch_origins(const std::vector<GURL>& origins) { |
| 156 foreign_fetch_origins_ = origins; |
| 157 } |
| 158 |
| 152 // This sets the new status and also run status change callbacks | 159 // This sets the new status and also run status change callbacks |
| 153 // if there're any (see RegisterStatusChangeCallback). | 160 // if there're any (see RegisterStatusChangeCallback). |
| 154 void SetStatus(Status status); | 161 void SetStatus(Status status); |
| 155 | 162 |
| 156 // Registers status change callback. (This is for one-off observation, | 163 // Registers status change callback. (This is for one-off observation, |
| 157 // the consumer needs to re-register if it wants to continue observing | 164 // the consumer needs to re-register if it wants to continue observing |
| 158 // status changes) | 165 // status changes) |
| 159 void RegisterStatusChangeCallback(const base::Closure& callback); | 166 void RegisterStatusChangeCallback(const base::Closure& callback); |
| 160 | 167 |
| 161 // Starts an embedded worker for this version. | 168 // Starts an embedded worker for this version. |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 const std::string& client_uuid, | 561 const std::string& client_uuid, |
| 555 const ServiceWorkerClientInfo& client); | 562 const ServiceWorkerClientInfo& client); |
| 556 void OnSkipWaiting(int request_id); | 563 void OnSkipWaiting(int request_id); |
| 557 void OnClaimClients(int request_id); | 564 void OnClaimClients(int request_id); |
| 558 void OnPongFromWorker(); | 565 void OnPongFromWorker(); |
| 559 | 566 |
| 560 void OnFocusClientFinished(int request_id, | 567 void OnFocusClientFinished(int request_id, |
| 561 const std::string& client_uuid, | 568 const std::string& client_uuid, |
| 562 const ServiceWorkerClientInfo& client); | 569 const ServiceWorkerClientInfo& client); |
| 563 | 570 |
| 564 void OnRegisterForeignFetchScopes(const std::vector<GURL>& sub_scopes); | 571 void OnRegisterForeignFetchScopes(const std::vector<GURL>& sub_scopes, |
| 572 const std::vector<GURL>& origins); |
| 565 | 573 |
| 566 void DidEnsureLiveRegistrationForStartWorker( | 574 void DidEnsureLiveRegistrationForStartWorker( |
| 567 const StatusCallback& callback, | 575 const StatusCallback& callback, |
| 568 ServiceWorkerStatusCode status, | 576 ServiceWorkerStatusCode status, |
| 569 const scoped_refptr<ServiceWorkerRegistration>& registration); | 577 const scoped_refptr<ServiceWorkerRegistration>& registration); |
| 570 void StartWorkerInternal(); | 578 void StartWorkerInternal(); |
| 571 | 579 |
| 572 void DidSkipWaiting(int request_id); | 580 void DidSkipWaiting(int request_id); |
| 573 | 581 |
| 574 void OnGetClientsFinished(int request_id, ServiceWorkerClients* clients); | 582 void OnGetClientsFinished(int request_id, ServiceWorkerClients* clients); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 // Called at the beginning of each Dispatch*Event function: records | 645 // Called at the beginning of each Dispatch*Event function: records |
| 638 // the time elapsed since idle (generally the time since the previous | 646 // the time elapsed since idle (generally the time since the previous |
| 639 // event ended). | 647 // event ended). |
| 640 void OnBeginEvent(); | 648 void OnBeginEvent(); |
| 641 | 649 |
| 642 const int64_t version_id_; | 650 const int64_t version_id_; |
| 643 const int64_t registration_id_; | 651 const int64_t registration_id_; |
| 644 const GURL script_url_; | 652 const GURL script_url_; |
| 645 const GURL scope_; | 653 const GURL scope_; |
| 646 std::vector<GURL> foreign_fetch_scopes_; | 654 std::vector<GURL> foreign_fetch_scopes_; |
| 655 std::vector<GURL> foreign_fetch_origins_; |
| 647 | 656 |
| 648 Status status_ = NEW; | 657 Status status_ = NEW; |
| 649 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 658 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
| 650 std::vector<StatusCallback> start_callbacks_; | 659 std::vector<StatusCallback> start_callbacks_; |
| 651 std::vector<StatusCallback> stop_callbacks_; | 660 std::vector<StatusCallback> stop_callbacks_; |
| 652 std::vector<base::Closure> status_change_callbacks_; | 661 std::vector<base::Closure> status_change_callbacks_; |
| 653 | 662 |
| 654 // Message callbacks. (Update HasInflightRequests() too when you update this | 663 // Message callbacks. (Update HasInflightRequests() too when you update this |
| 655 // list.) | 664 // list.) |
| 656 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_; | 665 IDMap<PendingRequest<FetchCallback>, IDMapOwnPointer> fetch_requests_; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 801 |
| 793 // At this point |this| can have been deleted, so don't do anything other | 802 // At this point |this| can have been deleted, so don't do anything other |
| 794 // than returning. | 803 // than returning. |
| 795 | 804 |
| 796 return true; | 805 return true; |
| 797 } | 806 } |
| 798 | 807 |
| 799 } // namespace content | 808 } // namespace content |
| 800 | 809 |
| 801 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 810 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |