OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/media/router/media_route.h" | 9 #include "chrome/browser/media/router/media_route.h" |
10 #include "content/public/browser/presentation_service_delegate.h" | |
10 | 11 |
11 namespace media_router { | 12 namespace media_router { |
12 | 13 |
13 class MediaRouter; | 14 class MediaRouter; |
14 | 15 |
15 // Base class for observing state changes on a PresentationConnection. | 16 // Observes state changes on a PresentationConnection and returns the new state |
mark a. foltz
2015/11/12 04:19:38
Is the caller expected to find out the current sta
imcheng
2015/11/16 23:52:01
For our current use case, it is not needed. We sta
| |
17 // to the supplied PresentationConnectionStateChangedCallback. | |
mark a. foltz
2015/11/12 04:19:38
Clarify that this callback is run multiple times -
imcheng
2015/11/16 23:52:01
Done in media_router.h.
| |
16 class PresentationConnectionStateObserver { | 18 class PresentationConnectionStateObserver { |
17 public: | 19 public: |
20 // |state_changed_cb|: The callback to invoke with state changes. | |
18 // |router|: The MediaRouter instance to register this instance with. | 21 // |router|: The MediaRouter instance to register this instance with. |
19 // |route_id|: ID of MediaRoute connected to the PresentationConnection to | 22 // |route_id|: ID of MediaRoute connected to the PresentationConnection to |
20 // be observed. | 23 // be observed. |
21 PresentationConnectionStateObserver(MediaRouter* router, | 24 PresentationConnectionStateObserver( |
22 const MediaRoute::Id& route_id); | 25 const content::PresentationConnectionStateChangedCallback& |
26 state_changed_cb, | |
27 const content::PresentationSessionInfo& connection, | |
28 const MediaRoute::Id& route_id, | |
29 MediaRouter* router); | |
23 virtual ~PresentationConnectionStateObserver(); | 30 virtual ~PresentationConnectionStateObserver(); |
24 | 31 |
25 MediaRoute::Id route_id() const { return route_id_; } | 32 MediaRoute::Id route_id() const { return route_id_; } |
26 | 33 |
27 // Invoked when the state of PresentationConnection represented by |route_id_| | 34 // Invoked when the state of PresentationConnection represented by |route_id_| |
28 // has changed to |state|. | 35 // has changed to |state|. |
29 virtual void OnStateChanged(content::PresentationConnectionState state) {} | 36 void OnStateChanged(content::PresentationConnectionState state); |
30 | 37 |
31 private: | 38 private: |
39 const content::PresentationConnectionStateChangedCallback state_changed_cb_; | |
40 const content::PresentationSessionInfo connection_; | |
41 const MediaRoute::Id route_id_; | |
32 MediaRouter* const router_; | 42 MediaRouter* const router_; |
33 const MediaRoute::Id route_id_; | |
34 | 43 |
35 DISALLOW_COPY_AND_ASSIGN(PresentationConnectionStateObserver); | 44 DISALLOW_COPY_AND_ASSIGN(PresentationConnectionStateObserver); |
36 }; | 45 }; |
37 | 46 |
38 } // namespace media_router | 47 } // namespace media_router |
39 | 48 |
40 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ | 49 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_CONNECTION_STATE_OBSERVER_H_ |
OLD | NEW |