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

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 and refactor Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved.
mark a. foltz 2017/01/23 22:29:34 2017 here and elsewhere in new files :)
zhaobin 2017/01/24 19:28:46 Done.
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 using OnMessageCallback = base::Callback<void(bool)>;
18
19 // This class represents a browser side PresentationConnection. It connects with
20 // PresentationConnection owned by a render frame to enable message exchange.
21 // Message received on this class is further routed to media router. State of
22 // browser side PresentationConnection is always 'connected'.
23 //
24 // |SetTargetConnection| sets |target_connection_| to mojo handle of
25 // PresentationConnection object owned a render frame, and transits state of
26 // |target_connection_| to 'connected'.
27 //
28 // Send message from page to media router:
29 // PresentationConnection::sendString();
30 // -> PresentationDispatcher::DoSendMessage();
31 // -> PresentationConnectionProxy::SendSessionMessage();
32 // --> (mojo call to browser side PresentationConnection)
33 // -> BrowserPresentationConnectionProxy::OnMessage();
34 // -> MediaRouter::SendRouteMessage();
35 //
36 // Instance of this class is only created for remotely rendered presentations.
37 // It is owned by PresentationFrame. When PresentationFrame gets destroyed,
38 // instance of this class will also be destroyed.
mark a. foltz 2017/01/23 22:29:34 How does the lifetime of this class relate to the
zhaobin 2017/01/24 19:28:46 Object will be destroyed if |route_| is closed or
39
40 class BrowserPresentationConnectionProxy
41 : public NON_EXPORTED_BASE(blink::mojom::PresentationConnection) {
42 public:
43 BrowserPresentationConnectionProxy(const content::PresentationSessionInfo&,
44 MediaRouter* router,
45 MediaRoute* route);
46 ~BrowserPresentationConnectionProxy() override;
47
48 void Bind(blink::mojom::PresentationConnectionRequest);
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_;
59
60 // |router_| not owned by this class.
61 MediaRouter* router_;
62 // |route_| not owned by this class.
63 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