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