| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ |
| 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/public/common/presentation_connection_message.h" | 9 #include "content/public/common/presentation_connection_message.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nConnectionProxy.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" | 12 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 class WebPresentationConnection; | 15 class WebPresentationConnection; |
| 16 class WebPresentationReceiver; |
| 16 } // namespace blink | 17 } // namespace blink |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 // This class connects PresentationConnection owned by one frame with | 21 // This class connects PresentationConnection owned by one frame with |
| 21 // PresentationConnection owned by a different frame. | 22 // PresentationConnection owned by a different frame. |
| 22 // | 23 // |
| 23 // PresentationConnectionProxy's ctor sets |source_connection_| to | 24 // PresentationConnectionProxy's ctor sets |source_connection_| to |
| 24 // PresentationConnection object owned by one frame. | 25 // PresentationConnection object owned by one frame. |
| 25 // | 26 // |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void NotifyTargetConnection( | 90 void NotifyTargetConnection( |
| 90 blink::WebPresentationConnectionState state) override; | 91 blink::WebPresentationConnectionState state) override; |
| 91 | 92 |
| 92 protected: | 93 protected: |
| 93 explicit PresentationConnectionProxy( | 94 explicit PresentationConnectionProxy( |
| 94 blink::WebPresentationConnection* source_connection); | 95 blink::WebPresentationConnection* source_connection); |
| 95 mojo::Binding<blink::mojom::PresentationConnection> binding_; | 96 mojo::Binding<blink::mojom::PresentationConnection> binding_; |
| 96 mojo::InterfacePtr<blink::mojom::PresentationConnection> | 97 mojo::InterfacePtr<blink::mojom::PresentationConnection> |
| 97 target_connection_ptr_; | 98 target_connection_ptr_; |
| 98 | 99 |
| 99 private: | |
| 100 // Raw pointer to Blink connection object owning this proxy object. Does not | 100 // Raw pointer to Blink connection object owning this proxy object. Does not |
| 101 // take ownership. | 101 // take ownership. |
| 102 blink::WebPresentationConnection* const source_connection_; | 102 blink::WebPresentationConnection* const source_connection_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 // Represents PresentationConnectionProxy object on controlling frame. | 105 // Represents PresentationConnectionProxy object on controlling frame. |
| 106 class CONTENT_EXPORT ControllerConnectionProxy | 106 class CONTENT_EXPORT ControllerConnectionProxy |
| 107 : public PresentationConnectionProxy { | 107 : public PresentationConnectionProxy { |
| 108 public: | 108 public: |
| 109 explicit ControllerConnectionProxy( | 109 explicit ControllerConnectionProxy( |
| 110 blink::WebPresentationConnection* controller_connection); | 110 blink::WebPresentationConnection* controller_connection); |
| 111 ~ControllerConnectionProxy() override; | 111 ~ControllerConnectionProxy() override; |
| 112 | 112 |
| 113 blink::mojom::PresentationConnectionPtr Bind(); | 113 blink::mojom::PresentationConnectionPtr Bind(); |
| 114 blink::mojom::PresentationConnectionRequest MakeRemoteRequest(); | 114 blink::mojom::PresentationConnectionRequest MakeRemoteRequest(); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 // Represents PresentationConnectionProxy object on receiver frame. | 117 // Represents PresentationConnectionProxy object on receiver frame. |
| 118 class CONTENT_EXPORT ReceiverConnectionProxy | 118 class CONTENT_EXPORT ReceiverConnectionProxy |
| 119 : public PresentationConnectionProxy { | 119 : public PresentationConnectionProxy { |
| 120 public: | 120 public: |
| 121 explicit ReceiverConnectionProxy( | 121 ReceiverConnectionProxy(blink::WebPresentationConnection* receiver_connection, |
| 122 blink::WebPresentationConnection* receiver_connection); | 122 blink::WebPresentationReceiver* receiver); |
| 123 ~ReceiverConnectionProxy() override; | 123 ~ReceiverConnectionProxy() override; |
| 124 | 124 |
| 125 void Bind( | 125 void Bind( |
| 126 blink::mojom::PresentationConnectionRequest receiver_connection_request); | 126 blink::mojom::PresentationConnectionRequest receiver_connection_request); |
| 127 | 127 |
| 128 // Sets |target_connection_ptr_| to |controller_connection_ptr|. Should be | 128 // Sets |target_connection_ptr_| to |controller_connection_ptr|. Should be |
| 129 // called only once. | 129 // called only once. |
| 130 void BindControllerConnection( | 130 void BindControllerConnection( |
| 131 blink::mojom::PresentationConnectionPtr controller_connection_ptr); | 131 blink::mojom::PresentationConnectionPtr controller_connection_ptr); |
| 132 |
| 133 // PresentationConnectionProxy override |
| 134 void DidChangeState(content::PresentationConnectionState state) override; |
| 135 |
| 136 private: |
| 137 // Raw pointer to PresentationReceiver. This class does not take ownership of |
| 138 // |receiver_|. |
| 139 blink::WebPresentationReceiver* receiver_; |
| 132 }; | 140 }; |
| 133 | 141 |
| 134 } // namespace content | 142 } // namespace content |
| 135 | 143 |
| 136 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ | 144 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_CONNECTION_PROXY_H_ |
| OLD | NEW |