Chromium Code Reviews| Index: chrome/browser/media/router/media_route.h |
| diff --git a/chrome/browser/media/router/media_route.h b/chrome/browser/media/router/media_route.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e1e3a84e719465f9b2c148c233bbca2bc41e0008 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_route.h |
| @@ -0,0 +1,85 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/gtest_prod_util.h" |
| +#include "base/logging.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/media/router/media_route_id.h" |
| +#include "chrome/browser/media/router/media_sink.h" |
| +#include "chrome/browser/media/router/media_source.h" |
| +#include "url/gurl.h" |
| + |
| +namespace media_router { |
| + |
| +using RouteRequestId = int64; |
| + |
| +class MediaRouteFactory; |
| + |
| +// For now, a simple transition graph: NEW -> CONNECTED -> CLOSED. |
| +enum MediaRouteState { |
| + // The route is new and not yet connected to a sink. |
| + MEDIA_ROUTE_STATE_NEW, |
| + // The route is active and connected to a sink. |
| + MEDIA_ROUTE_STATE_CONNECTED, |
| + // The route has been disconnected. |
| + MEDIA_ROUTE_STATE_CLOSED |
| +}; |
| + |
| +// MediaRoute objects contain the status and metadata of a routing |
| +// operation. The fields are immutable and reflect the route status |
| +// only at the time of object creation. Updated route statuses must |
| +// be retrieved as new MediaRoute objects from the Media Router. |
| +struct MediaRoute { |
|
xhwang
2015/03/09 17:37:31
For struct, you should make the member variables p
Kevin M
2015/03/09 23:32:06
Done.
|
| + public: |
| + ~MediaRoute(); |
| + |
| + // The media route identifier. |
| + const MediaRouteId& media_route_id() const { return media_route_id_; } |
| + |
| + // The state of the media route. |
| + MediaRouteState state() const { return state_; } |
| + |
| + // The media source being routed. |
| + const MediaSource& media_source() const { return media_source_; } |
| + |
| + // The ID of the sink being routed to. |
| + const MediaSinkId& sink_id() const { return sink_id_; } |
| + |
| + // The description of the media route activity, for example |
| + // "Playing Foo Bar Music All Access." |
| + // TODO(kmarshall): Do we need to pass locale for bidi rendering? |
| + const std::string& description() const { return description_; } |
| + |
| + // Returns |true| if the route is created locally (versus discovered |
| + // by a media route provider.) |
| + bool is_local() const { return is_local_; } |
| + |
| + bool Equals(const MediaRoute& other) const; |
| + |
| + private: |
| + friend class MediaRouteFactory; |
| + FRIEND_TEST_ALL_PREFIXES(MediaRouteTest, Equals); |
|
xhwang
2015/03/09 17:37:31
It seems MediaRouteTest is not accessing any priva
Kevin M
2015/03/09 23:32:06
Done.
|
| + |
| + MediaRoute(const MediaRouteId& media_route_id, |
| + const MediaSource& media_source, |
| + const MediaSinkId& sink_id, |
| + const std::string& description, |
| + bool is_local); |
| + |
| + const MediaRouteId media_route_id_; |
| + const MediaSource media_source_; |
| + const MediaSinkId sink_id_; |
| + const std::string description_; |
| + const bool is_local_; |
| + const MediaRouteState state_; |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ |