Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 1656933003: Add origins argument to registerForeignFetchScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add url::Origin::operator== to make tests simpler Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
27 #include "content/browser/service_worker/embedded_worker_instance.h" 27 #include "content/browser/service_worker/embedded_worker_instance.h"
28 #include "content/browser/service_worker/service_worker_metrics.h" 28 #include "content/browser/service_worker/service_worker_metrics.h"
29 #include "content/browser/service_worker/service_worker_script_cache_map.h" 29 #include "content/browser/service_worker/service_worker_script_cache_map.h"
30 #include "content/common/content_export.h" 30 #include "content/common/content_export.h"
31 #include "content/common/service_worker/service_worker_status_code.h" 31 #include "content/common/service_worker/service_worker_status_code.h"
32 #include "content/common/service_worker/service_worker_types.h" 32 #include "content/common/service_worker/service_worker_types.h"
33 #include "content/public/common/service_registry.h" 33 #include "content/public/common/service_registry.h"
34 #include "ipc/ipc_message.h" 34 #include "ipc/ipc_message.h"
35 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h" 35 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h"
36 #include "url/gurl.h"
37 #include "url/origin.h"
36 38
37 // Windows headers will redefine SendMessage. 39 // Windows headers will redefine SendMessage.
38 #ifdef SendMessage 40 #ifdef SendMessage
39 #undef SendMessage 41 #undef SendMessage
40 #endif 42 #endif
41 43
42 class GURL;
43
44 namespace net { 44 namespace net {
45 class HttpResponseInfo; 45 class HttpResponseInfo;
46 } 46 }
47 47
48 namespace content { 48 namespace content {
49 49
50 class EmbeddedWorkerRegistry; 50 class EmbeddedWorkerRegistry;
51 class ServiceWorkerContextCore; 51 class ServiceWorkerContextCore;
52 class ServiceWorkerProviderHost; 52 class ServiceWorkerProviderHost;
53 class ServiceWorkerRegistration; 53 class ServiceWorkerRegistration;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ServiceWorkerVersionInfo GetInfo(); 139 ServiceWorkerVersionInfo GetInfo();
140 Status status() const { return status_; } 140 Status status() const { return status_; }
141 141
142 const std::vector<GURL>& foreign_fetch_scopes() const { 142 const std::vector<GURL>& foreign_fetch_scopes() const {
143 return foreign_fetch_scopes_; 143 return foreign_fetch_scopes_;
144 } 144 }
145 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { 145 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) {
146 foreign_fetch_scopes_ = scopes; 146 foreign_fetch_scopes_ = scopes;
147 } 147 }
148 148
149 const std::vector<url::Origin>& foreign_fetch_origins() const {
150 return foreign_fetch_origins_;
151 }
152 void set_foreign_fetch_origins(const std::vector<url::Origin>& origins) {
153 foreign_fetch_origins_ = origins;
154 }
155
149 // This sets the new status and also run status change callbacks 156 // This sets the new status and also run status change callbacks
150 // if there're any (see RegisterStatusChangeCallback). 157 // if there're any (see RegisterStatusChangeCallback).
151 void SetStatus(Status status); 158 void SetStatus(Status status);
152 159
153 // Registers status change callback. (This is for one-off observation, 160 // Registers status change callback. (This is for one-off observation,
154 // the consumer needs to re-register if it wants to continue observing 161 // the consumer needs to re-register if it wants to continue observing
155 // status changes) 162 // status changes)
156 void RegisterStatusChangeCallback(const base::Closure& callback); 163 void RegisterStatusChangeCallback(const base::Closure& callback);
157 164
158 // Starts an embedded worker for this version. 165 // Starts an embedded worker for this version.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 const std::string& client_uuid, 565 const std::string& client_uuid,
559 const ServiceWorkerClientInfo& client); 566 const ServiceWorkerClientInfo& client);
560 void OnSkipWaiting(int request_id); 567 void OnSkipWaiting(int request_id);
561 void OnClaimClients(int request_id); 568 void OnClaimClients(int request_id);
562 void OnPongFromWorker(); 569 void OnPongFromWorker();
563 570
564 void OnFocusClientFinished(int request_id, 571 void OnFocusClientFinished(int request_id,
565 const std::string& client_uuid, 572 const std::string& client_uuid,
566 const ServiceWorkerClientInfo& client); 573 const ServiceWorkerClientInfo& client);
567 574
568 void OnRegisterForeignFetchScopes(const std::vector<GURL>& sub_scopes); 575 void OnRegisterForeignFetchScopes(const std::vector<GURL>& sub_scopes,
576 const std::vector<url::Origin>& origins);
569 577
570 void DidEnsureLiveRegistrationForStartWorker( 578 void DidEnsureLiveRegistrationForStartWorker(
571 const StatusCallback& callback, 579 const StatusCallback& callback,
572 ServiceWorkerStatusCode status, 580 ServiceWorkerStatusCode status,
573 const scoped_refptr<ServiceWorkerRegistration>& registration); 581 const scoped_refptr<ServiceWorkerRegistration>& registration);
574 void StartWorkerInternal(); 582 void StartWorkerInternal();
575 583
576 void DidSkipWaiting(int request_id); 584 void DidSkipWaiting(int request_id);
577 585
578 void OnGetClientsFinished(int request_id, ServiceWorkerClients* clients); 586 void OnGetClientsFinished(int request_id, ServiceWorkerClients* clients);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 // Called at the beginning of each Dispatch*Event function: records 649 // Called at the beginning of each Dispatch*Event function: records
642 // the time elapsed since idle (generally the time since the previous 650 // the time elapsed since idle (generally the time since the previous
643 // event ended). 651 // event ended).
644 void OnBeginEvent(); 652 void OnBeginEvent();
645 653
646 const int64_t version_id_; 654 const int64_t version_id_;
647 const int64_t registration_id_; 655 const int64_t registration_id_;
648 const GURL script_url_; 656 const GURL script_url_;
649 const GURL scope_; 657 const GURL scope_;
650 std::vector<GURL> foreign_fetch_scopes_; 658 std::vector<GURL> foreign_fetch_scopes_;
659 std::vector<url::Origin> foreign_fetch_origins_;
651 660
652 Status status_ = NEW; 661 Status status_ = NEW;
653 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; 662 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_;
654 std::vector<StatusCallback> start_callbacks_; 663 std::vector<StatusCallback> start_callbacks_;
655 std::vector<StatusCallback> stop_callbacks_; 664 std::vector<StatusCallback> stop_callbacks_;
656 std::vector<base::Closure> status_change_callbacks_; 665 std::vector<base::Closure> status_change_callbacks_;
657 666
658 // Message callbacks. (Update HasInflightRequests() too when you update this 667 // Message callbacks. (Update HasInflightRequests() too when you update this
659 // list.) 668 // list.)
660 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_; 669 IDMap<PendingRequest<StatusCallback>, IDMapOwnPointer> custom_requests_;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 804
796 // At this point |this| can have been deleted, so don't do anything other 805 // At this point |this| can have been deleted, so don't do anything other
797 // than returning. 806 // than returning.
798 807
799 return true; 808 return true;
800 } 809 }
801 810
802 } // namespace content 811 } // namespace content
803 812
804 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 813 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698