Chromium Code Reviews| 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_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 return running_hosted_version_.get(); | 88 return running_hosted_version_.get(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SetDocumentUrl(const GURL& url); | 91 void SetDocumentUrl(const GURL& url); |
| 92 const GURL& document_url() const { return document_url_; } | 92 const GURL& document_url() const { return document_url_; } |
| 93 | 93 |
| 94 void SetTopmostFrameUrl(const GURL& url); | 94 void SetTopmostFrameUrl(const GURL& url); |
| 95 const GURL& topmost_frame_url() const { return topmost_frame_url_; } | 95 const GURL& topmost_frame_url() const { return topmost_frame_url_; } |
| 96 | 96 |
| 97 // Associates to |registration| to listen for its version change events. | 97 // Associates to |registration| to listen for its version change events. |
| 98 void AssociateRegistration(ServiceWorkerRegistration* registration); | 98 void AssociateRegistration(ServiceWorkerRegistration* registration, |
| 99 bool should_notify_controller_change = false); | |
|
michaeln
2015/01/28 00:55:13
This flag seems odd? Also it shouldn't have a defa
xiang
2015/01/28 05:38:35
Done.
| |
| 99 | 100 |
| 100 // Clears the associated registration and stop listening to it. | 101 // Clears the associated registration and stop listening to it. |
| 101 void DisassociateRegistration(); | 102 void DisassociateRegistration(); |
| 102 | 103 |
| 103 // Returns false if the version is not in the expected STARTING in our | 104 // Returns false if the version is not in the expected STARTING in our |
| 104 // process state. That would be indicative of a bad IPC message. | 105 // process state. That would be indicative of a bad IPC message. |
| 105 bool SetHostedVersionId(int64 versions_id); | 106 bool SetHostedVersionId(int64 versions_id); |
| 106 | 107 |
| 107 // Returns a handler for a request, the handler may return NULL if | 108 // Returns a handler for a request, the handler may return NULL if |
| 108 // the request doesn't require special handling. | 109 // the request doesn't require special handling. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 133 | 134 |
| 134 // Activates the WebContents associated with | 135 // Activates the WebContents associated with |
| 135 // { render_process_id_, render_frame_id_ }. | 136 // { render_process_id_, render_frame_id_ }. |
| 136 // Runs the |callback| with the result in parameter describing whether the | 137 // Runs the |callback| with the result in parameter describing whether the |
| 137 // focusing action was successful. | 138 // focusing action was successful. |
| 138 void Focus(const FocusCallback& callback); | 139 void Focus(const FocusCallback& callback); |
| 139 | 140 |
| 140 // Asks the renderer to send back the document information. | 141 // Asks the renderer to send back the document information. |
| 141 void GetClientInfo(int embedded_worker_id, int request_id); | 142 void GetClientInfo(int embedded_worker_id, int request_id); |
| 142 | 143 |
| 144 // Starts using the |registration|. | |
| 145 void SetController(ServiceWorkerRegistration* registration); | |
|
falken
2015/01/26 08:45:13
This API gets a bit confusing: this function is a
falken
2015/01/26 08:45:41
I meant to write: fold them into one OR have bette
michaeln
2015/01/28 00:55:13
Agreed, please don't use SetController() as the na
| |
| 146 | |
| 143 // Adds reference of this host's process to the |pattern|, the reference will | 147 // Adds reference of this host's process to the |pattern|, the reference will |
| 144 // be removed in destructor. | 148 // be removed in destructor. |
| 145 void AddScopedProcessReferenceToPattern(const GURL& pattern); | 149 void AddScopedProcessReferenceToPattern(const GURL& pattern); |
| 146 | 150 |
| 147 // Methods to support cross site navigations. | 151 // Methods to support cross site navigations. |
| 148 void PrepareForCrossSiteTransfer(); | 152 void PrepareForCrossSiteTransfer(); |
| 149 void CompleteCrossSiteTransfer( | 153 void CompleteCrossSiteTransfer( |
| 150 int new_process_id, | 154 int new_process_id, |
| 151 int new_frame_id, | 155 int new_frame_id, |
| 152 int new_provider_id, | 156 int new_provider_id, |
| 153 ServiceWorkerDispatcherHost* dispatcher_host); | 157 ServiceWorkerDispatcherHost* dispatcher_host); |
| 154 ServiceWorkerDispatcherHost* dispatcher_host() const { | 158 ServiceWorkerDispatcherHost* dispatcher_host() const { |
| 155 return dispatcher_host_; | 159 return dispatcher_host_; |
| 156 } | 160 } |
| 157 | 161 |
| 158 private: | 162 private: |
| 159 friend class ServiceWorkerProviderHostTest; | 163 friend class ServiceWorkerProviderHostTest; |
| 160 friend class ServiceWorkerWriteToCacheJobTest; | 164 friend class ServiceWorkerWriteToCacheJobTest; |
| 161 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 165 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
| 162 UpdateBefore24Hours); | 166 UpdateBefore24Hours); |
| 163 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 167 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
| 164 UpdateAfter24Hours); | 168 UpdateAfter24Hours); |
| 165 | 169 |
| 166 // ServiceWorkerRegistration::Listener overrides. | 170 // ServiceWorkerRegistration::Listener overrides. |
| 167 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; | 171 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; |
| 168 void OnSkippedWaiting(ServiceWorkerRegistration* registration) override; | 172 void OnSkippedWaiting(ServiceWorkerRegistration* registration) override; |
| 169 | 173 |
| 170 // Sets the controller version field to |version| or if |version| is NULL, | 174 // Sets the controller version field to |version| or if |version| is NULL, |
| 171 // clears the field. | 175 // clears the field. |
| 172 void SetControllerVersionAttribute(ServiceWorkerVersion* version); | 176 void SetControllerVersionAttribute(ServiceWorkerVersion* version, |
| 177 bool should_notify_controller_change); | |
| 173 | 178 |
| 174 void SendAssociateRegistrationMessage(); | 179 void SendAssociateRegistrationMessage(); |
| 175 | 180 |
| 176 // Increase/decrease this host's process reference for |pattern|. | 181 // Increase/decrease this host's process reference for |pattern|. |
| 177 void IncreaseProcessReference(const GURL& pattern); | 182 void IncreaseProcessReference(const GURL& pattern); |
| 178 void DecreaseProcessReference(const GURL& pattern); | 183 void DecreaseProcessReference(const GURL& pattern); |
| 179 | 184 |
| 180 int render_process_id_; | 185 int render_process_id_; |
| 181 int render_frame_id_; | 186 int render_frame_id_; |
| 182 int provider_id_; | 187 int provider_id_; |
| 183 GURL document_url_; | 188 GURL document_url_; |
| 184 GURL topmost_frame_url_; | 189 GURL topmost_frame_url_; |
| 185 | 190 |
| 186 std::vector<GURL> associated_patterns_; | 191 std::vector<GURL> associated_patterns_; |
| 187 scoped_refptr<ServiceWorkerRegistration> associated_registration_; | 192 scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
| 188 | 193 |
| 189 scoped_refptr<ServiceWorkerVersion> controlling_version_; | 194 scoped_refptr<ServiceWorkerVersion> controlling_version_; |
| 190 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; | 195 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
| 191 base::WeakPtr<ServiceWorkerContextCore> context_; | 196 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 192 ServiceWorkerDispatcherHost* dispatcher_host_; | 197 ServiceWorkerDispatcherHost* dispatcher_host_; |
| 193 bool allow_association_; | 198 bool allow_association_; |
| 194 | 199 |
| 195 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 200 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
| 196 }; | 201 }; |
| 197 | 202 |
| 198 } // namespace content | 203 } // namespace content |
| 199 | 204 |
| 200 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 205 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| OLD | NEW |