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_MEDIA_ROUTE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_
10 #include "base/gtest_prod_util.h"
11 #include "base/logging.h"
12 #include "base/values.h"
13 #include "chrome/browser/media/router/media_sink.h"
14 #include "chrome/browser/media/router/media_source.h"
17 namespace media_router
{
19 // For now, a simple transition graph: NEW -> CONNECTED -> CLOSED.
20 enum MediaRouteState
{
21 // The route is new and not yet connected to a sink.
22 MEDIA_ROUTE_STATE_NEW
,
23 // The route is active and connected to a sink.
24 MEDIA_ROUTE_STATE_CONNECTED
,
25 // The route has been disconnected.
26 MEDIA_ROUTE_STATE_CLOSED
29 // MediaRoute objects contain the status and metadata of a routing
30 // operation. The fields are immutable and reflect the route status
31 // only at the time of object creation. Updated route statuses must
32 // be retrieved as new MediaRoute objects from the Media Router.
35 using Id
= std::string
;
37 // |media_route_id|: ID of the route. New route IDs should be created
38 // by the RouteIdManager class.
39 // |media_source|: Description of source of the route.
40 // |media_sink|: The sink that is receiving the media.
41 // |description|: Description of the route to be displayed.
42 // |is_local|: true if the route was created from this browser.
43 MediaRoute(const MediaRoute::Id
& media_route_id
,
44 const MediaSource
& media_source
,
45 const MediaSink
& media_sink
,
46 const std::string
& description
,
50 // The media route identifier.
51 const MediaRoute::Id
& media_route_id() const { return media_route_id_
; }
53 // The state of the media route.
54 MediaRouteState
state() const { return state_
; }
56 // The media source being routed.
57 const MediaSource
& media_source() const { return media_source_
; }
59 // The sink being routed to.
60 const MediaSink
& media_sink() const { return media_sink_
; }
62 // The description of the media route activity, for example
63 // "Playing Foo Bar Music All Access."
64 // TODO(kmarshall): Do we need to pass locale for bidi rendering?
65 const std::string
& description() const { return description_
; }
67 // Returns |true| if the route is created locally (versus discovered
68 // by a media route provider.)
69 bool is_local() const { return is_local_
; }
71 bool Equals(const MediaRoute
& other
) const;
74 MediaRoute::Id media_route_id_
;
75 MediaSource media_source_
;
76 MediaSink media_sink_
;
77 std::string description_
;
79 MediaRouteState state_
;
82 } // namespace media_router
84 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_