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

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: resolve code review comments from Mark 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 "content/public/browser/presentation_service_delegate.h"
9 #include "content/public/common/presentation_session.h"
10 #include "mojo/public/cpp/bindings/binding.h"
11
12 namespace media_router {
13
14 class MediaRouter;
15 class MediaRoute;
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 BrowserPresentationConnectionProxy(const content::PresentationSessionInfo&,
44 MediaRouter* router,
45 const MediaRoute* route);
46 ~BrowserPresentationConnectionProxy() override;
47
48 void Bind(blink::mojom::PresentationConnectionRequest);
mark a. foltz 2017/01/27 18:30:05 Outside of third_party/WebKit we the Media Router
mark a. foltz 2017/01/27 18:52:01 Slight correction. Parameter names can be omitte
zhaobin 2017/01/27 22:11:40 Acknowledged.
zhaobin 2017/01/27 22:11:40 Adding them back.
49 void SetTargetConnection(blink::mojom::PresentationConnectionPtr connection);
50
51 // blink::mojom::PresentationConnection implementation
52 void OnMessage(blink::mojom::ConnectionMessagePtr message,
53 const OnMessageCallback& callback) override;
54 void DidChangeState(
55 blink::mojom::PresentationConnectionState state) override {}
56
57 private:
58 content::PresentationSessionInfo session_info_;
mark a. foltz 2017/01/27 18:30:05 The PresentationSessionInfo passed here only seems
zhaobin 2017/01/27 22:11:40 Removed.
59
60 // |router_| not owned by this class.
61 MediaRouter* router_;
62 // |route_| not owned by this class.
63 const MediaRoute* route_;
64
65 mojo::Binding<blink::mojom::PresentationConnection> binding_;
66 blink::mojom::PresentationConnectionPtr target_connection_;
67 };
68
69 } // namespace media_router
70
71 #endif // CHROME_BROWSER_MEDIA_ROUTER_BROWSER_PRESENTATION_CONNECTION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698