Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: chrome/browser/media/router/media_route.h

Issue 1077963002: Revert of [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | chrome/browser/media/router/media_router.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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_MEDIA_ROUTE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/media/router/media_route_id.h" 13 #include "chrome/browser/media/router/media_route_id.h"
14 #include "chrome/browser/media/router/media_sink.h" 14 #include "chrome/browser/media/router/media_sink.h"
15 #include "chrome/browser/media/router/media_source.h" 15 #include "chrome/browser/media/router/media_source.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace media_router { 18 namespace media_router {
19 19
20 using RouteRequestId = int64;
21
22 class MediaRouteFactory;
23
20 // For now, a simple transition graph: NEW -> CONNECTED -> CLOSED. 24 // For now, a simple transition graph: NEW -> CONNECTED -> CLOSED.
21 enum MediaRouteState { 25 enum MediaRouteState {
22 // The route is new and not yet connected to a sink. 26 // The route is new and not yet connected to a sink.
23 MEDIA_ROUTE_STATE_NEW, 27 MEDIA_ROUTE_STATE_NEW,
24 // The route is active and connected to a sink. 28 // The route is active and connected to a sink.
25 MEDIA_ROUTE_STATE_CONNECTED, 29 MEDIA_ROUTE_STATE_CONNECTED,
26 // The route has been disconnected. 30 // The route has been disconnected.
27 MEDIA_ROUTE_STATE_CLOSED 31 MEDIA_ROUTE_STATE_CLOSED
28 }; 32 };
29 33
30 // MediaRoute objects contain the status and metadata of a routing 34 // MediaRoute objects contain the status and metadata of a routing
31 // operation. The fields are immutable and reflect the route status 35 // operation. The fields are immutable and reflect the route status
32 // only at the time of object creation. Updated route statuses must 36 // only at the time of object creation. Updated route statuses must
33 // be retrieved as new MediaRoute objects from the Media Router. 37 // be retrieved as new MediaRoute objects from the Media Router.
34 class MediaRoute { 38 class MediaRoute {
35 public: 39 public:
36 // |media_route_id|: ID of the route. New route IDs should be created 40 // |media_route_id|: ID of the route. New route IDs should be created
37 // by the RouteIdManager class. 41 // by the RouteIdManager class.
38 // |media_source|: Description of source of the route. 42 // |media_source|: Description of source of the route.
39 // |media_sink|: The sink that is receiving the media. 43 // |media_sink|: The sink that is receiving the media.
40 // |description|: Description of the route to be displayed. 44 // |description|: Description of the route to be displayed.
41 // |is_local|: true if the route was created from this browser. 45 // |is_local|: true if the route was created from this browser.
42 MediaRoute(const MediaRouteId& media_route_id, 46 MediaRoute(const MediaRouteId& media_route_id,
43 const MediaSource& media_source, 47 const MediaSource& media_source,
44 const MediaSink& media_sink, 48 const MediaSink& media_sink,
45 const std::string& description, 49 const std::string& description,
46 bool is_local); 50 bool is_local);
51
47 ~MediaRoute(); 52 ~MediaRoute();
48 53
49 // The media route identifier. 54 // The media route identifier.
50 const MediaRouteId& media_route_id() const { return media_route_id_; } 55 const MediaRouteId& media_route_id() const { return media_route_id_; }
51 56
52 // The state of the media route. 57 // The state of the media route.
53 MediaRouteState state() const { return state_; } 58 MediaRouteState state() const { return state_; }
54 59
55 // The media source being routed. 60 // The media source being routed.
56 const MediaSource& media_source() const { return media_source_; } 61 const MediaSource& media_source() const { return media_source_; }
57 62
58 // The sink being routed to. 63 // The sink being routed to.
59 const MediaSink& media_sink() const { return media_sink_; } 64 const MediaSink& media_sink() const { return media_sink_; }
60 65
61 // The description of the media route activity, for example 66 // The description of the media route activity, for example
62 // "Playing Foo Bar Music All Access." 67 // "Playing Foo Bar Music All Access."
63 // TODO(kmarshall): Do we need to pass locale for bidi rendering? 68 // TODO(kmarshall): Do we need to pass locale for bidi rendering?
64 const std::string& description() const { return description_; } 69 const std::string& description() const { return description_; }
65 70
66 // Returns |true| if the route is created locally (versus discovered 71 // Returns |true| if the route is created locally (versus discovered
67 // by a media route provider.) 72 // by a media route provider.)
68 bool is_local() const { return is_local_; } 73 bool is_local() const { return is_local_; }
69 74
70 bool Equals(const MediaRoute& other) const; 75 bool Equals(const MediaRoute& other) const;
71 76
72 private: 77 private:
73 MediaRouteId media_route_id_; 78 const MediaRouteId media_route_id_;
74 MediaSource media_source_; 79 const MediaSource media_source_;
75 MediaSink media_sink_; 80 const MediaSink media_sink_;
76 std::string description_; 81 const std::string description_;
77 bool is_local_; 82 const bool is_local_;
78 MediaRouteState state_; 83 const MediaRouteState state_;
79 }; 84 };
80 85
81 } // namespace media_router 86 } // namespace media_router
82 87
83 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ 88 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | chrome/browser/media/router/media_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698