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_MEDIA_ROUTE_RESPONSE_H_ | |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/media/router/media_route.h" | |
12 | |
13 namespace media_router { | |
14 | |
15 // Response to a media route request to the Media Route Provider. | |
mark a. foltz
2015/03/27 21:21:58
Response from the media route provider to a media
imcheng
2015/03/30 22:49:09
Done.
| |
16 class MediaRouteResponse { | |
17 public: | |
18 // Creates a MediaRouteResponse object that indicates success. | |
19 // |request_id|: ID of original request. | |
20 // |route|: Route created. | |
21 static scoped_ptr<MediaRouteResponse> Success( | |
mark a. foltz
2015/03/27 21:21:58
CreateFromRoute?
imcheng
2015/03/30 22:49:09
Done.
| |
22 const RouteRequestId& request_id, | |
23 const MediaRoute& route); | |
24 // Creates a MediaRouteResponse object that indicates failure. | |
mark a. foltz
2015/03/27 21:21:58
A newline here would help IMO.
imcheng
2015/03/30 22:49:09
Done.
| |
25 // |request_id|: ID of original request. | |
26 // |error|: Failure reason. | |
27 static scoped_ptr<MediaRouteResponse> Error(const RouteRequestId& request_id, | |
28 const std::string& error); | |
mark a. foltz
2015/03/27 21:21:58
CreateFromError
imcheng
2015/03/30 22:49:09
Done.
| |
29 | |
30 ~MediaRouteResponse(); | |
31 | |
32 const RouteRequestId& request_id() const { return request_id_; } | |
33 // Returns the route created. Returns an empty route if response | |
34 // indicates error. | |
35 const MediaRoute& route() const { return route_; } | |
36 const std::string& error() const { return error_; } | |
mark a. foltz
2015/03/27 21:21:58
Might mention that this returns an empty string on
imcheng
2015/03/30 22:49:09
Done.
| |
37 | |
38 private: | |
39 MediaRouteResponse(const RouteRequestId& request_id, const MediaRoute& route); | |
40 MediaRouteResponse(const RouteRequestId& request_id, | |
41 const std::string& error); | |
42 | |
43 // ID of original request. Set in all MediaRouteResponse objects, regardless | |
44 // of success/failure. | |
45 const RouteRequestId request_id_; | |
46 // The route created as a result of the request. Set to a valid MediaRoute | |
47 // iff the response indicates success, empty MediaRoute otherwise. | |
48 const MediaRoute route_; | |
49 // Set to empty string if response indicates success, otherwise set to the | |
50 // failure reason. | |
51 const std::string error_; | |
52 }; | |
53 | |
54 } // namespace media_router | |
55 | |
56 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_ | |
OLD | NEW |