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 using FocusCallback = base::Callback<void(bool)>; | 48 typedef base::Callback<void(bool)> FocusCallback; |
49 using GetClientInfoCallback = | |
50 base::Callback<void(const ServiceWorkerClientInfo&)>; | |
51 | 49 |
52 // If |render_frame_id| is MSG_ROUTING_NONE, this provider host works for the | 50 // If |render_frame_id| is MSG_ROUTING_NONE, this provider host works for the |
53 // worker context. | 51 // worker context. |
54 ServiceWorkerProviderHost(int render_process_id, | 52 ServiceWorkerProviderHost(int render_process_id, |
55 int render_frame_id, | 53 int render_frame_id, |
56 int provider_id, | 54 int provider_id, |
57 base::WeakPtr<ServiceWorkerContextCore> context, | 55 base::WeakPtr<ServiceWorkerContextCore> context, |
58 ServiceWorkerDispatcherHost* dispatcher_host); | 56 ServiceWorkerDispatcherHost* dispatcher_host); |
59 virtual ~ServiceWorkerProviderHost(); | 57 virtual ~ServiceWorkerProviderHost(); |
60 | 58 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void PostMessage(const base::string16& message, | 139 void PostMessage(const base::string16& message, |
142 const std::vector<int>& sent_message_port_ids); | 140 const std::vector<int>& sent_message_port_ids); |
143 | 141 |
144 // Activates the WebContents associated with | 142 // Activates the WebContents associated with |
145 // { render_process_id_, render_frame_id_ }. | 143 // { render_process_id_, render_frame_id_ }. |
146 // Runs the |callback| with the result in parameter describing whether the | 144 // Runs the |callback| with the result in parameter describing whether the |
147 // focusing action was successful. | 145 // focusing action was successful. |
148 void Focus(const FocusCallback& callback); | 146 void Focus(const FocusCallback& callback); |
149 | 147 |
150 // Asks the renderer to send back the document information. | 148 // Asks the renderer to send back the document information. |
151 void GetClientInfo(const GetClientInfoCallback& callback); | 149 void GetClientInfo(int embedded_worker_id, int request_id); |
152 | 150 |
153 // 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 |
154 // be removed in destructor. | 152 // be removed in destructor. |
155 void AddScopedProcessReferenceToPattern(const GURL& pattern); | 153 void AddScopedProcessReferenceToPattern(const GURL& pattern); |
156 | 154 |
157 // Methods to support cross site navigations. | 155 // Methods to support cross site navigations. |
158 void PrepareForCrossSiteTransfer(); | 156 void PrepareForCrossSiteTransfer(); |
159 void CompleteCrossSiteTransfer( | 157 void CompleteCrossSiteTransfer( |
160 int new_process_id, | 158 int new_process_id, |
161 int new_frame_id, | 159 int new_frame_id, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 bool allow_association_; | 222 bool allow_association_; |
225 | 223 |
226 std::vector<base::Closure> queued_events_; | 224 std::vector<base::Closure> queued_events_; |
227 | 225 |
228 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 226 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
229 }; | 227 }; |
230 | 228 |
231 } // namespace content | 229 } // namespace content |
232 | 230 |
233 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 231 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |