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 17 matching lines...) Expand all Loading... | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebServiceWorkerContextClient_h | 31 #ifndef WebServiceWorkerContextClient_h |
32 #define WebServiceWorkerContextClient_h | 32 #define WebServiceWorkerContextClient_h |
33 | 33 |
34 #include "WebWorkerPermissionClientProxy.h" | 34 #include "WebWorkerPermissionClientProxy.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class WebDataSource; | |
38 class WebString; | 39 class WebString; |
39 class WebServiceWorkerContextProxy; | 40 class WebServiceWorkerContextProxy; |
40 class WebServiceWorkerResponse; | 41 class WebServiceWorkerResponse; |
42 class WebURLRequest; | |
43 class WebURLResponse; | |
44 | |
45 // This interface is implemented by the client and is only called on the main th read. | |
46 // FIXME: put this in a seperate .h | |
michaeln
2014/03/14 01:01:02
should be in another file, if we like this change
kinuko
2014/03/14 11:47:17
Yes I think this change makes sense
| |
47 class WebServiceWorkerNetworkProvider { | |
48 public: | |
49 virtual ~WebServiceWorkerNetworkProvider() { } | |
50 | |
51 // A request is about to be sent out, and the client may modify it. Request | |
52 // is writable, and changes to the URL, for example, will change the request | |
53 // made. If this request is the result of a redirect, then redirectResponse | |
54 // will be non-null and contain the response that triggered the redirect. | |
kinuko
2014/03/14 11:47:17
Is this comment from WebFrameClient? May give impr
michaeln
2014/03/15 01:22:39
Done, removed the redirectResponse param and fixed
| |
55 virtual void willSendRequest(blink::WebDataSource*, blink::WebURLRequest&, c onst blink::WebURLResponse& redirectResponse) { } | |
56 }; | |
41 | 57 |
42 // This interface is implemented by the client. It is suppoed to be created | 58 // This interface is implemented by the client. It is suppoed to be created |
43 // on the main thread and then passed on to the worker thread to be owned | 59 // on the main thread and then passed on to the worker thread to be owned |
44 // by a newly created WorkerGlobalScope. All methods of this class, except | 60 // by a newly created WorkerGlobalScope. All methods of this class, except |
45 // for workerContextFailedToStart(), are called on the worker thread. | 61 // for createServiceWorkerNetworkProvider() and workerContextFailedToStart(), |
62 // are called on the worker thread. | |
46 // FIXME: Split this into EmbeddedWorkerContextClient and | 63 // FIXME: Split this into EmbeddedWorkerContextClient and |
47 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker | 64 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker |
48 // framework for other implementation (like SharedWorker). | 65 // framework for other implementation (like SharedWorker). |
49 class WebServiceWorkerContextClient { | 66 class WebServiceWorkerContextClient { |
50 public: | 67 public: |
51 virtual ~WebServiceWorkerContextClient() { } | 68 virtual ~WebServiceWorkerContextClient() { } |
52 | 69 |
53 // A new WorkerGlobalScope is created and started to run on the | 70 // A new WorkerGlobalScope is created and started to run on the |
54 // worker thread. | 71 // worker thread. |
55 // This also gives back a proxy to the client to talk to the | 72 // This also gives back a proxy to the client to talk to the |
(...skipping 21 matching lines...) Expand all Loading... | |
77 // ServiceWorker specific method. Called after InstallEvent (dispatched | 94 // ServiceWorker specific method. Called after InstallEvent (dispatched |
78 // via WebServiceWorkerContextProxy) is handled by the ServiceWorker's | 95 // via WebServiceWorkerContextProxy) is handled by the ServiceWorker's |
79 // script context. | 96 // script context. |
80 virtual void didHandleInstallEvent(int installEventID) { } | 97 virtual void didHandleInstallEvent(int installEventID) { } |
81 | 98 |
82 // ServiceWorker specific methods. Called after FetchEvent is handled by the | 99 // ServiceWorker specific methods. Called after FetchEvent is handled by the |
83 // ServiceWorker's script context. When no response is provided, the browser | 100 // ServiceWorker's script context. When no response is provided, the browser |
84 // should fallback to native fetch. | 101 // should fallback to native fetch. |
85 virtual void didHandleFetchEvent(int fetchEventID) { } | 102 virtual void didHandleFetchEvent(int fetchEventID) { } |
86 virtual void didHandleFetchEvent(int fetchEventID, const WebServiceWorkerRes ponse& response) { } | 103 virtual void didHandleFetchEvent(int fetchEventID, const WebServiceWorkerRes ponse& response) { } |
104 | |
105 // Ownership of the returned object is transferred to the caller. | |
106 virtual WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider( blink::WebDataSource*) { return 0; } | |
87 }; | 107 }; |
88 | 108 |
89 } // namespace blink | 109 } // namespace blink |
90 | 110 |
91 #endif // WebWorkerContextClient_h | 111 #endif // WebWorkerContextClient_h |
OLD | NEW |