| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ROUTE_MESSAGE_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_ROUTE_MESSAGE_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_MESSAGE_OBSERVER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_MESSAGE_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/common/media_router/media_route.h" | 14 #include "chrome/common/media_router/media_route.h" |
| 15 | 15 |
| 16 namespace content { |
| 17 struct PresentationConnectionMessage; |
| 18 } |
| 19 |
| 16 namespace media_router { | 20 namespace media_router { |
| 17 | 21 |
| 18 class MediaRouter; | 22 class MediaRouter; |
| 19 struct RouteMessage; | |
| 20 | 23 |
| 21 // Observes messages originating from the MediaSink connected to a MediaRoute. | 24 // Observes messages originating from the MediaSink connected to a MediaRoute. |
| 22 // Messages are received from MediaRouter via |OnMessagesReceived|. | 25 // Messages are received from MediaRouter via |OnMessagesReceived|. |
| 26 // TODO(imcheng): Rename to PresentationConnectionMessageObserver. |
| 23 class RouteMessageObserver { | 27 class RouteMessageObserver { |
| 24 public: | 28 public: |
| 25 // |route_id|: ID of MediaRoute to listen for messages. | 29 // |route_id|: ID of MediaRoute to listen for messages. |
| 26 RouteMessageObserver(MediaRouter* router, const MediaRoute::Id& route_id); | 30 RouteMessageObserver(MediaRouter* router, const MediaRoute::Id& route_id); |
| 27 | 31 |
| 28 virtual ~RouteMessageObserver(); | 32 virtual ~RouteMessageObserver(); |
| 29 | 33 |
| 30 // Invoked by |router_| whenever messages are received from the route sink. | 34 // Invoked by |router_| whenever messages are received from the route sink. |
| 31 // |messages| is guaranteed to be non-empty. | 35 // |messages| is guaranteed to be non-empty. |
| 32 virtual void OnMessagesReceived( | 36 virtual void OnMessagesReceived( |
| 33 const std::vector<RouteMessage>& messages) = 0; | 37 const std::vector<content::PresentationConnectionMessage>& messages) = 0; |
| 34 | 38 |
| 35 const MediaRoute::Id& route_id() const { return route_id_; } | 39 const MediaRoute::Id& route_id() const { return route_id_; } |
| 36 | 40 |
| 37 private: | 41 private: |
| 38 MediaRouter* const router_; | 42 MediaRouter* const router_; |
| 39 const MediaRoute::Id route_id_; | 43 const MediaRoute::Id route_id_; |
| 40 | 44 |
| 41 DISALLOW_COPY_AND_ASSIGN(RouteMessageObserver); | 45 DISALLOW_COPY_AND_ASSIGN(RouteMessageObserver); |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 } // namespace media_router | 48 } // namespace media_router |
| 45 | 49 |
| 46 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_MESSAGE_OBSERVER_H_ | 50 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_MESSAGE_OBSERVER_H_ |
| OLD | NEW |