OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WebServicePortProvider_h | |
6 #define WebServicePortProvider_h | |
7 | |
8 #include "public/platform/WebCallbacks.h" | |
9 #include "public/platform/WebVector.h" | |
10 #include "public/platform/modules/navigator_services/WebServicePort.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class WebString; | |
15 class WebURL; | |
16 typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray; | |
17 | |
18 typedef WebCallbacks<WebServicePortID, void> WebServicePortConnectCallbacks; | |
19 | |
20 // One instance of this class is associated with each ServicePortCollection. | |
21 // When a ServicePortCollection is destroyed the WebServicePortProvider | |
22 // associated with it is also destroyed. All communication from ServicePorts and | |
23 // the ServicePortCollection to embedding code goes via this interface. | |
24 class WebServicePortProvider { | |
25 public: | |
26 virtual ~WebServicePortProvider() { } | |
27 | |
28 // Initiates a connection from the given origin to the given URL. When | |
29 // successful the service can communicate with the client over the given | |
30 // channel. The origin isn't passed as WebSecurityOrigin because that would | |
31 // be a layering violation (platform/ code shouldn't depend on web/ code). | |
32 // Ownership of the WebServicePortConnectCallbacks is transferred to the pro vider. | |
33 virtual void connect(const WebURL&, const WebString& origin, WebServicePortC onnectCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | |
34 | |
35 // Called when javascript code calls postMessage on a ServicePort that is ow ned | |
36 // by the ServicePortCollection this provider is associated with. | |
37 virtual void postMessage(WebServicePortID, const WebString&, WebMessagePortC hannelArray*) { BLINK_ASSERT_NOT_REACHED(); } | |
scheib
2015/06/24 04:16:55
I think: // Takes ownership of WebMessagePortChann
| |
38 | |
39 // Called when a ServicePort owned by the ServicePortCollection this | |
40 // provider is associated with is closed (explicitly or via garbage | |
41 // collection). | |
42 virtual void closePort(WebServicePortID) { BLINK_ASSERT_NOT_REACHED(); } | |
43 }; | |
44 | |
45 } // namespace blink | |
46 | |
47 #endif // WebServicePortProvider_h | |
OLD | NEW |