OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ROUTE_REQUEST_RESULT_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 INVALID_ORIGIN = 5, | 45 INVALID_ORIGIN = 5, |
46 INCOGNITO_MISMATCH = 6, | 46 INCOGNITO_MISMATCH = 6, |
47 NO_SUPPORTED_PROVIDER = 7, | 47 NO_SUPPORTED_PROVIDER = 7, |
48 CANCELLED = 8, | 48 CANCELLED = 8, |
49 // New values must be added here. | 49 // New values must be added here. |
50 | 50 |
51 TOTAL_COUNT = 9 // The total number of values. | 51 TOTAL_COUNT = 9 // The total number of values. |
52 }; | 52 }; |
53 | 53 |
54 static std::unique_ptr<RouteRequestResult> FromSuccess( | 54 static std::unique_ptr<RouteRequestResult> FromSuccess( |
55 std::unique_ptr<MediaRoute> route, | 55 const MediaRoute& route, |
56 const std::string& presentation_id); | 56 const std::string& presentation_id); |
57 static std::unique_ptr<RouteRequestResult> FromError(const std::string& error, | 57 static std::unique_ptr<RouteRequestResult> FromError(const std::string& error, |
58 ResultCode result_code); | 58 ResultCode result_code); |
| 59 RouteRequestResult(std::unique_ptr<MediaRoute> route, |
| 60 const std::string& presentation_id, |
| 61 const std::string& error, |
| 62 ResultCode result_code); |
59 | 63 |
60 ~RouteRequestResult(); | 64 ~RouteRequestResult(); |
61 | 65 |
62 // Note the caller does not own the returned MediaRoute. The caller must | 66 // Note the caller does not own the returned MediaRoute. The caller must |
63 // create a copy if they wish to use it after this object is destroyed. | 67 // create a copy if they wish to use it after this object is destroyed. |
64 const MediaRoute* route() const { return route_.get(); } | 68 const MediaRoute* route() const { return route_.get(); } |
65 std::string presentation_id() const { return presentation_id_; } | 69 std::string presentation_id() const { return presentation_id_; } |
66 GURL presentation_url() const { return presentation_url_; } | 70 GURL presentation_url() const { return presentation_url_; } |
67 std::string error() const { return error_; } | 71 std::string error() const { return error_; } |
68 ResultCode result_code() const { return result_code_; } | 72 ResultCode result_code() const { return result_code_; } |
69 | 73 |
70 private: | 74 private: |
71 RouteRequestResult(std::unique_ptr<MediaRoute> route, | |
72 const std::string& presentation_id, | |
73 const std::string& error, | |
74 ResultCode result_code); | |
75 | |
76 std::unique_ptr<MediaRoute> route_; | 75 std::unique_ptr<MediaRoute> route_; |
77 std::string presentation_id_; | 76 std::string presentation_id_; |
78 GURL presentation_url_; | 77 GURL presentation_url_; |
79 std::string error_; | 78 std::string error_; |
80 ResultCode result_code_; | 79 ResultCode result_code_; |
81 | 80 |
82 DISALLOW_COPY_AND_ASSIGN(RouteRequestResult); | 81 DISALLOW_COPY_AND_ASSIGN(RouteRequestResult); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace media_router | 84 } // namespace media_router |
86 | 85 |
87 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ | 86 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ |
OLD | NEW |