| 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 27 matching lines...) Expand all Loading... |
| 38 // object is tied to the lifetime of its document in the renderer process. | 38 // object is tied to the lifetime of its document in the renderer process. |
| 39 // This class holds service worker state that is scoped to an individual | 39 // This class holds service worker state that is scoped to an individual |
| 40 // document. | 40 // document. |
| 41 // | 41 // |
| 42 // Note this class can also host a running service worker, in which | 42 // Note this class can also host a running service worker, in which |
| 43 // case it will observe resource loads made directly by the service worker. | 43 // case it will observe resource loads made directly by the service worker. |
| 44 class CONTENT_EXPORT ServiceWorkerProviderHost | 44 class CONTENT_EXPORT ServiceWorkerProviderHost |
| 45 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), | 45 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
| 46 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { | 46 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
| 47 public: | 47 public: |
| 48 typedef base::Callback<void(bool)> FocusCallback; | 48 using FocusCallback = base::Callback<void(bool)>; |
| 49 using GetClientInfoCallback = |
| 50 base::Callback<void(const ServiceWorkerClientInfo&)>; |
| 49 | 51 |
| 50 ServiceWorkerProviderHost(int render_process_id, | 52 ServiceWorkerProviderHost(int render_process_id, |
| 51 int render_frame_id, | 53 int render_frame_id, |
| 52 int provider_id, | 54 int provider_id, |
| 53 base::WeakPtr<ServiceWorkerContextCore> context, | 55 base::WeakPtr<ServiceWorkerContextCore> context, |
| 54 ServiceWorkerDispatcherHost* dispatcher_host); | 56 ServiceWorkerDispatcherHost* dispatcher_host); |
| 55 virtual ~ServiceWorkerProviderHost(); | 57 virtual ~ServiceWorkerProviderHost(); |
| 56 | 58 |
| 57 int process_id() const { return render_process_id_; } | 59 int process_id() const { return render_process_id_; } |
| 58 int provider_id() const { return provider_id_; } | 60 int provider_id() const { return provider_id_; } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void PostMessage(const base::string16& message, | 139 void PostMessage(const base::string16& message, |
| 138 const std::vector<int>& sent_message_port_ids); | 140 const std::vector<int>& sent_message_port_ids); |
| 139 | 141 |
| 140 // Activates the WebContents associated with | 142 // Activates the WebContents associated with |
| 141 // { render_process_id_, render_frame_id_ }. | 143 // { render_process_id_, render_frame_id_ }. |
| 142 // Runs the |callback| with the result in parameter describing whether the | 144 // Runs the |callback| with the result in parameter describing whether the |
| 143 // focusing action was successful. | 145 // focusing action was successful. |
| 144 void Focus(const FocusCallback& callback); | 146 void Focus(const FocusCallback& callback); |
| 145 | 147 |
| 146 // Asks the renderer to send back the document information. | 148 // Asks the renderer to send back the document information. |
| 147 void GetClientInfo(int embedded_worker_id, int request_id); | 149 void GetClientInfo(const GetClientInfoCallback& callback); |
| 148 | 150 |
| 149 // Adds reference of this host's process to the |pattern|, the reference will | 151 // Adds reference of this host's process to the |pattern|, the reference will |
| 150 // be removed in destructor. | 152 // be removed in destructor. |
| 151 void AddScopedProcessReferenceToPattern(const GURL& pattern); | 153 void AddScopedProcessReferenceToPattern(const GURL& pattern); |
| 152 | 154 |
| 153 // Methods to support cross site navigations. | 155 // Methods to support cross site navigations. |
| 154 void PrepareForCrossSiteTransfer(); | 156 void PrepareForCrossSiteTransfer(); |
| 155 void CompleteCrossSiteTransfer( | 157 void CompleteCrossSiteTransfer( |
| 156 int new_process_id, | 158 int new_process_id, |
| 157 int new_frame_id, | 159 int new_frame_id, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 base::WeakPtr<ServiceWorkerContextCore> context_; | 214 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 213 ServiceWorkerDispatcherHost* dispatcher_host_; | 215 ServiceWorkerDispatcherHost* dispatcher_host_; |
| 214 bool allow_association_; | 216 bool allow_association_; |
| 215 | 217 |
| 216 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 218 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
| 217 }; | 219 }; |
| 218 | 220 |
| 219 } // namespace content | 221 } // namespace content |
| 220 | 222 |
| 221 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 223 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| OLD | NEW |