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

Side by Side Diff: content/public/browser/service_worker_context.h

Issue 2052613003: Speculatively launch Service Workers on mouse/touch events. [3/5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary includes Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "content/public/browser/service_worker_usage_info.h" 12 #include "content/public/browser/service_worker_usage_info.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 namespace blink {
16 enum class WebNavigationHintType;
17 }
18
15 namespace content { 19 namespace content {
16 20
17 // Represents the per-StoragePartition ServiceWorker data. 21 // Represents the per-StoragePartition ServiceWorker data.
18 class ServiceWorkerContext { 22 class ServiceWorkerContext {
19 public: 23 public:
20 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: 24 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope:
21 // roughly, must be of the form "<origin>/<path>/*". 25 // roughly, must be of the form "<origin>/<path>/*".
22 typedef GURL Scope; 26 typedef GURL Scope;
23 27
24 typedef base::Callback<void(bool success)> ResultCallback; 28 typedef base::Callback<void(bool success)> ResultCallback;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; 102 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0;
99 103
100 // Stops all running service workers and unregisters all service worker 104 // Stops all running service workers and unregisters all service worker
101 // registrations. This method is used in LayoutTests to make sure that the 105 // registrations. This method is used in LayoutTests to make sure that the
102 // existing service worker will not affect the succeeding tests. 106 // existing service worker will not affect the succeeding tests.
103 // 107 //
104 // This function can be called from any thread, but the callback will always 108 // This function can be called from any thread, but the callback will always
105 // be called on the UI thread. 109 // be called on the UI thread.
106 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; 110 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0;
107 111
112 // Starts a Service Worker for |document_url| for a navigation hint in the
113 // specified render process |render_process_id|. Must be called from the UI
114 // thread. The |callback| will always be called on the UI thread.
115 // This method can fail if:
116 // * No Service Worker was registered for |document_url|.
117 // * The specified render process is not suitable for loading |document_url|.
118 virtual void StartServiceWorkerForNavigationHint(
119 const GURL& document_url,
120 blink::WebNavigationHintType type,
121 int render_process_id,
122 const ResultCallback& callback) = 0;
123
108 protected: 124 protected:
109 ServiceWorkerContext() {} 125 ServiceWorkerContext() {}
110 virtual ~ServiceWorkerContext() {} 126 virtual ~ServiceWorkerContext() {}
111 }; 127 };
112 128
113 } // namespace content 129 } // namespace content
114 130
115 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 131 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_metrics.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698