Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | |
| 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "mojo/public/cpp/bindings/binding.h" | |
| 10 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnection.h" | |
| 11 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnectionProxy.h" | |
| 12 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 // This class connects PrensentationConnection object living in | |
|
mark a. foltz
2016/10/21 00:53:03
typo in PresentationConnection
zhaobin
2016/10/22 02:44:13
Done.
| |
| 17 // controller(receiver) render process | |
|
mark a. foltz
2016/10/21 00:53:03
... one frame with a PresentationConnection owned
zhaobin
2016/10/22 02:44:13
Done.
| |
| 18 // with PresentationConnection object living in receiver(controller) render | |
| 19 // process. | |
|
mark a. foltz
2016/10/21 00:53:03
It's up to the embedder to decide whether the cont
zhaobin
2016/10/22 02:44:13
Done.
| |
| 20 // | |
| 21 // |SetSourceConnection| sets |source_connection_| to PresentationConnection | |
| 22 // object lives in current render process. | |
| 23 // |SetTargetConnection| sets |target_connection_| to mojo handle of | |
| 24 // PresentationConnection object lives in remote render process. | |
| 25 // | |
| 26 // When both |source_connection_| and |target_connection_| are set, | |
| 27 // we can send message or notify state changes between controller and receiver. | |
| 28 // | |
| 29 // To send message from controller page to receiver page: | |
|
mark a. foltz
2016/10/21 00:53:03
controlling frame to receiver frame:
zhaobin
2016/10/22 02:44:13
Done.
| |
| 30 // 1. controller page invokes connection.sendMessage(); | |
| 31 // 2. This call is delegated to controller presentation connection proxy's | |
| 32 // SendString(). | |
| 33 // PresentationConnectionProxy::SendString() { | |
| 34 // target_connection_->OnConnectionMessageReceived(); | |
| 35 // } | |
| 36 // 3. Receiver PresentationConnectionProxy::OnConnectionMessageReceived() is | |
| 37 // invoked. | |
| 38 // 4. connection.onmessage event on receiver page is fired. | |
| 39 // | |
| 40 // Sending message from receiver to controller and notifying state changes | |
| 41 // between controller and receiver works the same. | |
| 42 // | |
| 43 // Instance of this class is only created for 1-UA mode. | |
|
mark a. foltz
2016/10/21 00:53:03
s/1-UA mode/offscreen presentations/
zhaobin
2016/10/22 02:44:13
Done.
| |
| 44 class PresentationConnectionProxy | |
| 45 : public blink::WebPresentationConnectionProxy, | |
| 46 public NON_EXPORTED_BASE(blink::mojom::PresentationConnection) { | |
| 47 public: | |
| 48 PresentationConnectionProxy(); | |
| 49 ~PresentationConnectionProxy() override; | |
| 50 | |
| 51 blink::mojom::PresentationConnectionPtr Bind(); | |
| 52 | |
| 53 // WebPresentationConnectionProxy Implementation | |
| 54 void SetSourceConnection( | |
| 55 blink::WebPresentationConnection* connection) override; | |
| 56 void SendString(const blink::WebString& message) override; | |
| 57 void SendArrayBuffer(const uint8_t* data, size_t length) override; | |
| 58 | |
| 59 // blink::mojom::PresentationConnection implementation | |
| 60 void SetTargetConnection( | |
| 61 blink::mojom::PresentationConnectionPtr connection) override; | |
| 62 void OnConnectionMessageReceived( | |
| 63 blink::mojom::SessionMessagePtr message) override; | |
| 64 | |
| 65 private: | |
| 66 mojo::Binding<blink::mojom::PresentationConnection> binding_; | |
| 67 blink::mojom::PresentationConnectionPtr target_connection_; | |
| 68 blink::WebPresentationConnection* source_connection_; | |
| 69 }; | |
| 70 | |
| 71 } // namespace content | |
| 72 | |
| 73 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | |
| OLD | NEW |