| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" |
| 10 #include "chrome/browser/media/router/media_route.h" |
| 11 #include "content/public/browser/presentation_service_delegate.h" |
| 12 #include "content/public/browser/presentation_session.h" |
| 13 |
| 14 namespace media_router { |
| 15 |
| 16 class MediaRouter; |
| 17 |
| 18 // Observes messages originating from the MediaSink connected to a MediaRoute |
| 19 // that represents a presentation. |
| 20 // Messages are received from MediaRouter via |OnMessagesReceived|, where |
| 21 // |message_cb_| will be invoked. |
| 22 class PresentationSessionMessagesObserver { |
| 23 public: |
| 24 // |message_cb|: The callback to invoke whenever messages are received. |
| 25 // |route_id|: ID of MediaRoute to listen for messages. |
| 26 PresentationSessionMessagesObserver( |
| 27 const content::PresentationSessionMessageCallback& message_cb, |
| 28 const MediaRoute::Id& route_id, |
| 29 MediaRouter* router); |
| 30 ~PresentationSessionMessagesObserver(); |
| 31 |
| 32 // Invoked by |router_| whenever messages are received. Invokes |message_cb_| |
| 33 // with |messages|. |
| 34 // |messages| is guaranteed to be non-empty. |
| 35 void OnMessagesReceived( |
| 36 const ScopedVector<content::PresentationSessionMessage>& messages); |
| 37 |
| 38 const MediaRoute::Id& route_id() const { return route_id_; } |
| 39 |
| 40 private: |
| 41 content::PresentationSessionMessageCallback message_cb_; |
| 42 const MediaRoute::Id route_id_; |
| 43 MediaRouter* const router_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PresentationSessionMessagesObserver); |
| 46 }; |
| 47 |
| 48 } // namespace media_router |
| 49 |
| 50 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_ |
| OLD | NEW |