Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/media/router/browser_presentation_connection_proxy.h

Issue 2471573005: [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: merge with master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_BROWSER_PRESENTATION_CONNECTION_PROXY_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_BROWSER_PRESENTATION_CONNECTION_PROXY_H_
7
8 #include "chrome/browser/media/router/media_route.h"
9 #include "content/public/browser/presentation_service_delegate.h"
10 #include "content/public/common/presentation_session.h"
11 #include "mojo/public/cpp/bindings/binding.h"
12
13 namespace media_router {
14
15 class MediaRouter;
16
17 // This class represents a browser side PresentationConnection. It connects with
18 // PresentationConnection owned by a render frame to enable message exchange.
19 // Message received on this class is further routed to Media Router. State of
20 // browser side PresentationConnection is always 'connected'.
21 //
22 // |SetTargetConnection| sets |target_connection_| to mojo handle of
23 // PresentationConnection object owned a render frame, and transits state of
24 // |target_connection_| to 'connected'.
25 //
26 // Send message from render frame to media router:
27 // PresentationConnection::sendString();
28 // -> PresentationDispatcher::DoSendMessage();
29 // -> PresentationConnectionProxy::SendSessionMessage();
30 // --> (mojo call to browser side PresentationConnection)
31 // -> BrowserPresentationConnectionProxy::OnMessage();
32 // -> MediaRouter::SendRouteMessage();
33 //
34 // Instance of this class is only created for remotely rendered presentations.
35 // It is owned by PresentationFrame. When PresentationFrame gets destroyed or
36 // |route_| is closed or terminated, instance of this class will be destroyed.
37
38 class BrowserPresentationConnectionProxy
39 : public NON_EXPORTED_BASE(blink::mojom::PresentationConnection) {
40 public:
41 using OnMessageCallback = base::Callback<void(bool)>;
42
43 // |router|: media router instance not owned by this class;
44 // |route_id|: underlying media route. |target_connection_ptr_| sends message
45 // to media route with |route_id|;
46 // |receiver_connection_request|: mojo interface request to be bind with this
47 // object;
48 // |controller_connection_ptr|: mojo interface ptr of controlling frame's
49 // connection proxy object.
50 BrowserPresentationConnectionProxy(
51 MediaRouter* router,
52 const MediaRoute::Id& route_id,
53 blink::mojom::PresentationConnectionRequest receiver_connection_request,
54 blink::mojom::PresentationConnectionPtr controller_connection_ptr);
55 ~BrowserPresentationConnectionProxy() override;
56
57 // blink::mojom::PresentationConnection implementation
58 void OnMessage(blink::mojom::ConnectionMessagePtr message,
59 const OnMessageCallback& on_message_callback) override;
60
61 // Underlying media route is always connected. Media route class does not
62 // support state change.
63 void DidChangeState(content::PresentationConnectionState state) override {}
64
65 private:
66 // |router_| not owned by this class.
67 MediaRouter* const router_;
68 const MediaRoute::Id route_id_;
69
70 mojo::Binding<blink::mojom::PresentationConnection> binding_;
71 blink::mojom::PresentationConnectionPtr target_connection_ptr_;
72 };
73
74 } // namespace media_router
75
76 #endif // CHROME_BROWSER_MEDIA_ROUTER_BROWSER_PRESENTATION_CONNECTION_PROXY_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | chrome/browser/media/router/browser_presentation_connection_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698