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 from the media route provider to a media route request. | |
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> CreateFromSuccess( | |
22 const RouteRequestId& request_id, | |
23 const MediaRoute& route); | |
24 | |
25 // Creates a MediaRouteResponse object that indicates failure. | |
26 // |request_id|: ID of original request. | |
27 // |error|: Failure reason. | |
28 static scoped_ptr<MediaRouteResponse> CreateFromError( | |
29 const RouteRequestId& request_id, | |
30 const std::string& error); | |
31 | |
32 ~MediaRouteResponse(); | |
33 | |
34 const RouteRequestId& request_id() const { return request_id_; } | |
35 | |
36 // Returns the route created. Returns an empty route if response is error. | |
mark a. foltz
2015/03/31 22:10:24
...created, or an empty route if there was an erro
imcheng
2015/04/01 00:55:16
Done.
| |
37 const MediaRoute& route() const { return route_; } | |
38 | |
39 // Returns the error. Returns an empty string if response is success. | |
mark a. foltz
2015/03/31 22:10:24
error, or an empty string if the route was created
imcheng
2015/04/01 00:55:16
Done.
| |
40 const std::string& error() const { return error_; } | |
41 | |
42 private: | |
43 MediaRouteResponse(const RouteRequestId& request_id, const MediaRoute& route); | |
44 MediaRouteResponse(const RouteRequestId& request_id, | |
45 const std::string& error); | |
46 | |
47 // ID of original request. Set in all MediaRouteResponse objects, regardless | |
mark a. foltz
2015/03/31 22:10:24
Since the documentation in the public API describe
imcheng
2015/04/01 00:55:16
Removed comment son route_ and error_.
| |
48 // of success/failure. | |
49 const RouteRequestId request_id_; | |
50 // The route created as a result of the request. Set to a valid MediaRoute | |
51 // iff the response indicates success, empty MediaRoute otherwise. | |
52 const MediaRoute route_; | |
53 // Set to empty string if response indicates success, otherwise set to the | |
54 // failure reason. | |
55 const std::string error_; | |
56 }; | |
57 | |
58 } // namespace media_router | |
59 | |
60 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_RESPONSE_H_ | |
OLD | NEW |