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

Side by Side Diff: public/platform/WebServiceWorkerProvider.h

Issue 413123002: ServiceWorker: Implement ServiceWorkerRegistration [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix for tkent's comments Created 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #define WebServiceWorkerProvider_h 32 #define WebServiceWorkerProvider_h
33 33
34 #include "public/platform/WebCallbacks.h" 34 #include "public/platform/WebCallbacks.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class WebString; 38 class WebString;
39 class WebURL; 39 class WebURL;
40 class WebServiceWorker; 40 class WebServiceWorker;
41 class WebServiceWorkerProviderClient; 41 class WebServiceWorkerProviderClient;
42 class WebServiceWorkerRegistration;
42 struct WebServiceWorkerError; 43 struct WebServiceWorkerError;
43 44
44 // Created on the main thread, and may be passed to another script context 45 // Created on the main thread, and may be passed to another script context
45 // thread (e.g. worker thread) later. All methods of this class must be called 46 // thread (e.g. worker thread) later. All methods of this class must be called
46 // on the single script context thread. 47 // on the single script context thread.
47 class WebServiceWorkerProvider { 48 class WebServiceWorkerProvider {
48 public: 49 public:
49 // Called when a client wants to start listening to the service worker event s. Must be cleared before the client becomes invalid. 50 // Called when a client wants to start listening to the service worker
51 // events. Must be cleared before the client becomes invalid.
50 virtual void setClient(WebServiceWorkerProviderClient*) { } 52 virtual void setClient(WebServiceWorkerProviderClient*) { }
51 53
52 // The WebServiceWorker and WebServiceWorkerError ownership are passed to th e WebServiceWorkerCallbacks implementation. 54 // FIXME: Remove this macro after two-side patches are landed
55 // (http://crbug.com/396400).
56 #define DISABLE_SERVICE_WORKER_REGISTRATION
57 #ifdef DISABLE_SERVICE_WORKER_REGISTRATION
58 // The WebServiceWorker and WebServiceWorkerError ownership are passed to
59 // the WebServiceWorkerCallbacks implementation.
53 typedef WebCallbacks<WebServiceWorker, WebServiceWorkerError> WebServiceWork erCallbacks; 60 typedef WebCallbacks<WebServiceWorker, WebServiceWorkerError> WebServiceWork erCallbacks;
54 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri ptUrl, WebServiceWorkerCallbacks*) { } 61 typedef WebServiceWorkerCallbacks WebServiceWorkerRegistrationCallbacks;
62 #else
63 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are
64 // passed to the WebServiceWorkerRegistrationCallbacks implementation.
65 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We bServiceWorkerRegistrationCallbacks;
66 #endif
67
68 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri ptUrl, WebServiceWorkerRegistrationCallbacks*) { }
55 69
56 // Unregisters the ServiceWorker for a given scope. The provider 70 // Unregisters the ServiceWorker for a given scope. The provider
57 // must always pass null to onSuccess. 71 // must always pass null to onSuccess.
58 // FIXME: "unregister" does not provide a WebServiceWorker, revisit this 72 // FIXME: "unregister" does not provide a WebServiceWorkerRegistration,
59 // to clean up the the callback type to not take a WebServiceWorker*. 73 // revisit this to clean up the the callback type to not take a
60 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker Callbacks*) { } 74 // WebServiceWorkerRegistration*.
75 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker RegistrationCallbacks*) { }
61 76
62 virtual ~WebServiceWorkerProvider() { } 77 virtual ~WebServiceWorkerProvider() { }
63 }; 78 };
64 79
65 } // namespace blink 80 } // namespace blink
66 81
67 #endif 82 #endif
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerRegistration.idl ('k') | public/platform/WebServiceWorkerRegistration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698