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 12 matching lines...) Expand all Loading... | |
23 // be unique. | 23 // be unique. |
24 // |error|: Empty string. | 24 // |error|: Empty string. |
25 // |result_code|: RouteRequestResult::OK | 25 // |result_code|: RouteRequestResult::OK |
26 // On failure: | 26 // On failure: |
27 // |route|: nullptr | 27 // |route|: nullptr |
28 // |presentation_id|: Empty string. | 28 // |presentation_id|: Empty string. |
29 // |error|: Non-empty string describing the error. | 29 // |error|: Non-empty string describing the error. |
30 // |result_code|: A value from RouteRequestResult describing the error. | 30 // |result_code|: A value from RouteRequestResult describing the error. |
31 class RouteRequestResult { | 31 class RouteRequestResult { |
32 public: | 32 public: |
33 // Keep in sync with: | |
34 // - RouteRequestResultCode in media_router.mojom | |
35 // - MediaRouteProviderResult enum in tools/metrics/histograms.xml | |
Ilya Sherman
2016/07/18 22:56:57
Please also document that this enum should be trea
| |
36 // - mr.RouteRequestResultCode in route_request_error.js | |
33 enum ResultCode { | 37 enum ResultCode { |
34 UNKNOWN_ERROR, | 38 UNKNOWN_ERROR = 0, |
35 OK, | 39 OK = 1, |
36 TIMED_OUT, | 40 TIMED_OUT = 2, |
37 ROUTE_NOT_FOUND, | 41 ROUTE_NOT_FOUND = 3, |
38 INVALID_ORIGIN, | 42 SINK_NOT_FOUND = 4, |
39 OFF_THE_RECORD_MISMATCH | 43 INVALID_ORIGIN = 5, |
44 OFF_THE_RECORD_MISMATCH = 6, | |
45 NO_SUPPORTED_PROVIDER = 7, | |
46 | |
47 // This is the total number of values. | |
48 TOTAL_COUNT = 8 | |
40 }; | 49 }; |
41 | 50 |
42 static std::unique_ptr<RouteRequestResult> FromSuccess( | 51 static std::unique_ptr<RouteRequestResult> FromSuccess( |
43 std::unique_ptr<MediaRoute> route, | 52 std::unique_ptr<MediaRoute> route, |
44 const std::string& presentation_id); | 53 const std::string& presentation_id); |
45 static std::unique_ptr<RouteRequestResult> FromError(const std::string& error, | 54 static std::unique_ptr<RouteRequestResult> FromError(const std::string& error, |
46 ResultCode result_code); | 55 ResultCode result_code); |
47 | 56 |
48 ~RouteRequestResult(); | 57 ~RouteRequestResult(); |
49 | 58 |
(...skipping 14 matching lines...) Expand all Loading... | |
64 std::string presentation_id_; | 73 std::string presentation_id_; |
65 std::string error_; | 74 std::string error_; |
66 ResultCode result_code_; | 75 ResultCode result_code_; |
67 | 76 |
68 DISALLOW_COPY_AND_ASSIGN(RouteRequestResult); | 77 DISALLOW_COPY_AND_ASSIGN(RouteRequestResult); |
69 }; | 78 }; |
70 | 79 |
71 } // namespace media_router | 80 } // namespace media_router |
72 | 81 |
73 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ | 82 #endif // CHROME_BROWSER_MEDIA_ROUTER_ROUTE_REQUEST_RESULT_H_ |
OLD | NEW |