Rename GetIconID to GetIconId
[chromium-blink-merge.git] / chrome / browser / media / router / presentation_session_messages_observer.h
blob62c95127fb058f23f69c66283cc9cd6b4842550c
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.
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_
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"
14 namespace media_router {
16 class MediaRouter;
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();
32 // Invoked by |router_| whenever messages are received. Invokes |message_cb_|
33 // with |messages|.
34 // |messages| is guaranteed to be non-empty.
35 // If |pass_ownership| is true, then this observer may reuse buffers from the
36 // contents of |messages| without copying.
37 void OnMessagesReceived(
38 const ScopedVector<content::PresentationSessionMessage>& messages,
39 bool pass_ownership);
41 const MediaRoute::Id& route_id() const { return route_id_; }
43 private:
44 content::PresentationSessionMessageCallback message_cb_;
45 const MediaRoute::Id route_id_;
46 MediaRouter* const router_;
48 DISALLOW_COPY_AND_ASSIGN(PresentationSessionMessagesObserver);
51 } // namespace media_router
53 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SESSION_MESSAGES_OBSERVER_H_