OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // 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 |
46 // 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 |
47 // on the single script context thread. | 47 // on the single script context thread. |
48 class WebServiceWorkerProvider { | 48 class WebServiceWorkerProvider { |
49 public: | 49 public: |
50 // Called when a client wants to start listening to the service worker | 50 // Called when a client wants to start listening to the service worker |
51 // events. Must be cleared before the client becomes invalid. | 51 // events. Must be cleared before the client becomes invalid. |
52 virtual void setClient(WebServiceWorkerProviderClient*) { } | 52 virtual void setClient(WebServiceWorkerProviderClient*) { } |
53 | 53 |
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. | |
60 typedef WebCallbacks<WebServiceWorker, WebServiceWorkerError> WebServiceWork
erRegistrationCallbacks; | |
61 #else | |
62 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are | 54 // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are |
63 // passed to the WebServiceWorkerRegistrationCallbacks implementation. | 55 // passed to the WebServiceWorkerRegistrationCallbacks implementation. |
64 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; | 56 typedef WebCallbacks<WebServiceWorkerRegistration, WebServiceWorkerError> We
bServiceWorkerRegistrationCallbacks; |
65 #endif | |
66 | 57 |
67 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } | 58 virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scri
ptUrl, WebServiceWorkerRegistrationCallbacks*) { } |
68 | 59 |
69 // Unregisters the ServiceWorker for a given scope. The provider | 60 // Unregisters the ServiceWorker for a given scope. The provider |
70 // must always pass null to onSuccess. | 61 // must always pass null to onSuccess. |
71 // FIXME: "unregister" does not provide a WebServiceWorkerRegistration, | 62 // FIXME: "unregister" does not provide a WebServiceWorkerRegistration, |
72 // revisit this to clean up the the callback type to not take a | 63 // revisit this to clean up the the callback type to not take a |
73 // WebServiceWorkerRegistration*. | 64 // WebServiceWorkerRegistration*. |
74 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
RegistrationCallbacks*) { } | 65 virtual void unregisterServiceWorker(const WebURL& pattern, WebServiceWorker
RegistrationCallbacks*) { } |
75 | 66 |
76 virtual ~WebServiceWorkerProvider() { } | 67 virtual ~WebServiceWorkerProvider() { } |
77 }; | 68 }; |
78 | 69 |
79 } // namespace blink | 70 } // namespace blink |
80 | 71 |
81 #endif | 72 #endif |
OLD | NEW |